diff options
author | Mathias Stearn <mathias@10gen.com> | 2018-05-02 17:32:34 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2018-05-08 14:57:37 -0400 |
commit | db41862c5380ab33cf28db99726cdac252df0872 (patch) | |
tree | a0fefd08ea9cc063456abe796390faaaa07ec272 /src/mongo/db/commands/apply_ops_cmd.cpp | |
parent | 2d35461cb54e35afea223714fab1a184a9b381e2 (diff) | |
download | mongo-db41862c5380ab33cf28db99726cdac252df0872.tar.gz |
SERVER-34628 Really remove appendCommandStatus
All remaining callers are transitioned to some form of usassert. This was done
with an elaborate set of vim macros to make this tractable. Therefore it
should not be considered an example of the best way to write new code, just as
an improvement on what was there before. In particular, I couldn't easily
remove Status's that are named then only used once in uassertStatusOK, nor
could I convert the pattern of checking a StatusWith<T>'s getStatus() then
calling getValue() to just call uassertStatusOK(returnsStatusWith()).
Diffstat (limited to 'src/mongo/db/commands/apply_ops_cmd.cpp')
-rw-r--r-- | src/mongo/db/commands/apply_ops_cmd.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/mongo/db/commands/apply_ops_cmd.cpp b/src/mongo/db/commands/apply_ops_cmd.cpp index d78414e95ea..599f3a52902 100644 --- a/src/mongo/db/commands/apply_ops_cmd.cpp +++ b/src/mongo/db/commands/apply_ops_cmd.cpp @@ -225,9 +225,7 @@ public: maybeDisableValidation.emplace(opCtx); auto status = OplogApplicationChecks::checkOperationArray(cmdObj.firstElement()); - if (!status.isOK()) { - return CommandHelpers::appendCommandStatus(result, status); - } + uassertStatusOK(status); // TODO (SERVER-30217): When a write concern is provided to the applyOps command, we // normally wait on the OpTime of whichever operation successfully completed last. This is @@ -251,20 +249,16 @@ public: auto modeSW = repl::OplogApplication::parseMode(oplogApplicationModeString); if (!modeSW.isOK()) { // Unable to parse the mode argument. - return CommandHelpers::appendCommandStatus( - result, - modeSW.getStatus().withContext( - str::stream() - << "Could not parse " + repl::ApplyOps::kOplogApplicationModeFieldName)); + uassertStatusOK(modeSW.getStatus().withContext( + str::stream() << "Could not parse " + + repl::ApplyOps::kOplogApplicationModeFieldName)); } oplogApplicationMode = modeSW.getValue(); } else if (status != ErrorCodes::NoSuchKey) { // NoSuchKey means the user did not supply a mode. - return CommandHelpers::appendCommandStatus( - result, - status.withContext(str::stream() - << "Could not parse out " - << repl::ApplyOps::kOplogApplicationModeFieldName)); + uassertStatusOK(status.withContext(str::stream() + << "Could not parse out " + << repl::ApplyOps::kOplogApplicationModeFieldName)); } auto applyOpsStatus = CommandHelpers::appendCommandStatusNoThrow( |