diff options
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.cpp | 31 |
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) { |
