summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp')
-rw-r--r--src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp b/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
index 2a1ce64792a..682c0075340 100644
--- a/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/catalog/list_indexes.h"
#include "mongo/db/catalog/rename_collection.h"
#include "mongo/db/concurrency/d_concurrency.h"
-#include "mongo/db/concurrency/exception_util.h"
+#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/index_builds_coordinator.h"
#include "mongo/db/pipeline/document_source_cursor.h"
@@ -96,13 +96,13 @@ boost::optional<Document> NonShardServerProcessInterface::lookupSingleDocument(
return lookedUpDocument;
}
-Status NonShardServerProcessInterface::insert(
- const boost::intrusive_ptr<ExpressionContext>& expCtx,
- const NamespaceString& ns,
- std::unique_ptr<write_ops::InsertCommandRequest> insertCommand,
- const WriteConcernOptions& wc,
- boost::optional<OID> targetEpoch) {
- auto writeResults = write_ops_exec::performInserts(expCtx->opCtx, *insertCommand);
+Status NonShardServerProcessInterface::insert(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ const NamespaceString& ns,
+ std::vector<BSONObj>&& objs,
+ const WriteConcernOptions& wc,
+ boost::optional<OID> targetEpoch) {
+ auto writeResults = write_ops_exec::performInserts(
+ expCtx->opCtx, buildInsertOp(ns, std::move(objs), expCtx->bypassDocumentValidation));
// Need to check each result in the batch since the writes are unordered.
for (const auto& result : writeResults.results) {
@@ -116,12 +116,13 @@ Status NonShardServerProcessInterface::insert(
StatusWith<MongoProcessInterface::UpdateResult> NonShardServerProcessInterface::update(
const boost::intrusive_ptr<ExpressionContext>& expCtx,
const NamespaceString& ns,
- std::unique_ptr<write_ops::UpdateCommandRequest> updateCommand,
+ BatchedObjects&& batch,
const WriteConcernOptions& wc,
UpsertType upsert,
bool multi,
boost::optional<OID> targetEpoch) {
- auto writeResults = write_ops_exec::performUpdates(expCtx->opCtx, *updateCommand);
+ auto writeResults = write_ops_exec::performUpdates(
+ expCtx->opCtx, buildUpdateOp(expCtx, ns, std::move(batch), upsert, multi));
// Need to check each result in the batch since the writes are unordered.
UpdateResult updateResult;
@@ -183,10 +184,9 @@ void NonShardServerProcessInterface::renameIfOptionsAndIndexesHaveNotChanged(
RenameCollectionOptions options;
options.dropTarget = renameCommandObj["dropTarget"].trueValue();
options.stayTemp = renameCommandObj["stayTemp"].trueValue();
- options.originalCollectionOptions = originalCollectionOptions;
- options.originalIndexes = originalIndexes;
// skip sharding validation on non sharded servers
- doLocalRenameIfOptionsAndIndexesHaveNotChanged(opCtx, sourceNs, targetNs, options);
+ doLocalRenameIfOptionsAndIndexesHaveNotChanged(
+ opCtx, sourceNs, targetNs, options, originalIndexes, originalCollectionOptions);
}
void NonShardServerProcessInterface::createCollection(OperationContext* opCtx,
@@ -205,7 +205,6 @@ BSONObj NonShardServerProcessInterface::preparePipelineAndExplain(
Pipeline* ownedPipeline, ExplainOptions::Verbosity verbosity) {
std::vector<Value> pipelineVec;
auto firstStage = ownedPipeline->peekFront();
- auto opts = SerializationOptions{verbosity};
// If the pipeline already has a cursor explain with that one, otherwise attach a new one like
// we would for a normal execution and explain that.
if (firstStage && typeid(*firstStage) == typeid(DocumentSourceCursor)) {
@@ -213,7 +212,7 @@ BSONObj NonShardServerProcessInterface::preparePipelineAndExplain(
// extracted the necessary information and won't need it again.
std::unique_ptr<Pipeline, PipelineDeleter> managedPipeline(
ownedPipeline, PipelineDeleter(ownedPipeline->getContext()->opCtx));
- pipelineVec = managedPipeline->writeExplainOps(opts);
+ pipelineVec = managedPipeline->writeExplainOps(verbosity);
ownedPipeline = nullptr;
} else {
auto pipelineWithCursor = attachCursorSourceToPipelineForLocalRead(ownedPipeline);
@@ -222,7 +221,7 @@ BSONObj NonShardServerProcessInterface::preparePipelineAndExplain(
while (pipelineWithCursor->getNext()) {
}
}
- pipelineVec = pipelineWithCursor->writeExplainOps(opts);
+ pipelineVec = pipelineWithCursor->writeExplainOps(verbosity);
}
BSONArrayBuilder bab;
for (auto&& stage : pipelineVec) {