summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/oplog_note.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2018-05-02 17:32:34 -0400
committerMathias Stearn <mathias@10gen.com>2018-05-08 14:57:37 -0400
commitdb41862c5380ab33cf28db99726cdac252df0872 (patch)
treea0fefd08ea9cc063456abe796390faaaa07ec272 /src/mongo/db/commands/oplog_note.cpp
parent2d35461cb54e35afea223714fab1a184a9b381e2 (diff)
downloadmongo-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/oplog_note.cpp')
-rw-r--r--src/mongo/db/commands/oplog_note.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index 8cd038204d4..09a32cc0f6e 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -119,17 +119,13 @@ public:
BSONObjBuilder& result) {
auto replCoord = repl::ReplicationCoordinator::get(opCtx);
if (!replCoord->isReplEnabled()) {
- return CommandHelpers::appendCommandStatus(
- result,
- {ErrorCodes::NoReplicationEnabled,
- "Must have replication set up to run \"appendOplogNote\""});
+ uasserted(ErrorCodes::NoReplicationEnabled,
+ "Must have replication set up to run \"appendOplogNote\"");
}
BSONElement dataElement;
auto dataStatus = bsonExtractTypedField(cmdObj, "data", Object, &dataElement);
- if (!dataStatus.isOK()) {
- return CommandHelpers::appendCommandStatus(result, dataStatus);
- }
+ uassertStatusOK(dataStatus);
Timestamp maxClusterTime;
auto maxClusterTimeStatus =
@@ -137,24 +133,23 @@ public:
if (!maxClusterTimeStatus.isOK()) {
if (maxClusterTimeStatus == ErrorCodes::NoSuchKey) { // no need to use maxClusterTime
- return CommandHelpers::appendCommandStatus(
- result, _performNoopWrite(opCtx, dataElement.Obj(), "appendOpLogNote"));
+ uassertStatusOK(_performNoopWrite(opCtx, dataElement.Obj(), "appendOpLogNote"));
+ return true;
}
- return CommandHelpers::appendCommandStatus(result, maxClusterTimeStatus);
+ uassertStatusOK(maxClusterTimeStatus);
}
auto lastAppliedOpTime = replCoord->getMyLastAppliedOpTime().getTimestamp();
if (maxClusterTime > lastAppliedOpTime) {
- return CommandHelpers::appendCommandStatus(
- result, _performNoopWrite(opCtx, dataElement.Obj(), "appendOpLogNote"));
+ uassertStatusOK(_performNoopWrite(opCtx, dataElement.Obj(), "appendOpLogNote"));
} else {
std::stringstream ss;
ss << "Requested maxClusterTime " << LogicalTime(maxClusterTime).toString()
<< " is less or equal to the last primary OpTime: "
<< LogicalTime(lastAppliedOpTime).toString();
- return CommandHelpers::appendCommandStatus(result,
- {ErrorCodes::StaleClusterTime, ss.str()});
+ uasserted(ErrorCodes::StaleClusterTime, ss.str());
}
+ return true;
}
};