diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-03-05 15:48:48 -0500 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-03-06 10:04:53 -0500 |
commit | e3a3f54a6c0ec4f471e0aff7a48b8a30f8c0e9cb (patch) | |
tree | 9c2f4ac5a4d8751336397c8af59a08bf78f1c201 /src/mongo/db/service_entry_point_mongod.cpp | |
parent | 5dfa372b25b1a26bb12e09fdb029ff219b0f5343 (diff) | |
download | mongo-e3a3f54a6c0ec4f471e0aff7a48b8a30f8c0e9cb.tar.gz |
SERVER-33065 CommandReplyBuilder and CommandInvocation
Revert "Revert "SERVER-33065 CommandReplyBuilder and CommandInvocation""
This reverts commit 74177edb35b6ce7594e4751051010ceade592484.
Leave out the unintentional repl/ change this time.
Diffstat (limited to 'src/mongo/db/service_entry_point_mongod.cpp')
-rw-r--r-- | src/mongo/db/service_entry_point_mongod.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index 84c8534e6fb..eb281981054 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -51,11 +51,10 @@ public: } void waitForReadConcern(OperationContext* opCtx, - const Command* command, + const CommandInvocation* invocation, const OpMsgRequest& request) const override { - Status rcStatus = mongo::waitForReadConcern(opCtx, - repl::ReadConcernArgs::get(opCtx), - command->allowsAfterClusterTime(request.body)); + Status rcStatus = mongo::waitForReadConcern( + opCtx, repl::ReadConcernArgs::get(opCtx), invocation->allowsAfterClusterTime()); if (!rcStatus.isOK()) { if (rcStatus == ErrorCodes::ExceededTimeLimit) { @@ -64,7 +63,7 @@ public: LOG(debugLevel) << "Command on database " << request.getDatabase() << " timed out waiting for read concern to be satisfied. Command: " << redact(ServiceEntryPointCommon::getRedactedCopyForLogging( - command, request.body)); + invocation->definition(), request.body)); } uassertStatusOK(rcStatus); @@ -74,7 +73,7 @@ public: void waitForWriteConcern(OperationContext* opCtx, const std::string& commandName, const repl::OpTime& lastOpBeforeRun, - BSONObjBuilder* commandResponseBuilder) const override { + BSONObjBuilder commandResponseBuilder) const override { auto lastOpAfterRun = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); // Ensures that if we tried to do a write, we wait for write concern, even if that write was // a noop. @@ -88,15 +87,15 @@ public: auto waitForWCStatus = mongo::waitForWriteConcern(opCtx, lastOpAfterRun, opCtx->getWriteConcern(), &res); - CommandHelpers::appendCommandWCStatus(*commandResponseBuilder, waitForWCStatus, res); + CommandHelpers::appendCommandWCStatus(commandResponseBuilder, waitForWCStatus, res); // SERVER-22421: This code is to ensure error response backwards compatibility with the // user management commands. This can be removed in 3.6. if (!waitForWCStatus.isOK() && CommandHelpers::isUserManagementCommand(commandName)) { - BSONObj temp = commandResponseBuilder->asTempObj().copy(); - commandResponseBuilder->resetToEmpty(); - CommandHelpers::appendCommandStatus(*commandResponseBuilder, waitForWCStatus); - commandResponseBuilder->appendElementsUnique(temp); + BSONObj temp = commandResponseBuilder.asTempObj().copy(); + commandResponseBuilder.resetToEmpty(); + CommandHelpers::appendCommandStatus(commandResponseBuilder, waitForWCStatus); + commandResponseBuilder.appendElementsUnique(temp); } } @@ -115,8 +114,8 @@ public: } } - void attachCurOpErrInfo(OperationContext* opCtx, BSONObjBuilder& replyObj) const override { - CurOp::get(opCtx)->debug().errInfo = getStatusFromCommandResult(replyObj.asTempObj()); + void attachCurOpErrInfo(OperationContext* opCtx, const BSONObj& replyObj) const override { + CurOp::get(opCtx)->debug().errInfo = getStatusFromCommandResult(replyObj); } }; |