summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/repl_set_request_votes_args.cpp
diff options
context:
space:
mode:
authorXuerui Fa <xuerui.fa@mongodb.com>2020-03-20 13:45:19 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-26 14:04:41 +0000
commit9810e6d6986a3dc5bc1b5c57a524155bdba45452 (patch)
treee4264571f88e8fb347d938a19d723b4f1d702266 /src/mongo/db/repl/repl_set_request_votes_args.cpp
parent4382b9e9231ba5360e374e97df382f34602ccaa4 (diff)
downloadmongo-9810e6d6986a3dc5bc1b5c57a524155bdba45452.tar.gz
SERVER-46090: Remove references to lastCommittedOp
Diffstat (limited to 'src/mongo/db/repl/repl_set_request_votes_args.cpp')
-rw-r--r--src/mongo/db/repl/repl_set_request_votes_args.cpp47
1 files changed, 2 insertions, 45 deletions
diff --git a/src/mongo/db/repl/repl_set_request_votes_args.cpp b/src/mongo/db/repl/repl_set_request_votes_args.cpp
index d5a3b5b22a3..0dff3a3e22c 100644
--- a/src/mongo/db/repl/repl_set_request_votes_args.cpp
+++ b/src/mongo/db/repl/repl_set_request_votes_args.cpp
@@ -44,8 +44,6 @@ const std::string kCommandName = "replSetRequestVotes";
const std::string kConfigVersionFieldName = "configVersion";
const std::string kConfigTermFieldName = "configTerm";
const std::string kDryRunFieldName = "dryRun";
-// TODO: Remove references to the "lastCommittedOp" field name (SERVER-46090).
-const std::string kLastDurableOpTimeFieldName = "lastCommittedOp";
const std::string kLastAppliedOpTimeFieldName = "lastAppliedOpTime";
const std::string kOkFieldName = "ok";
const std::string kReasonFieldName = "reason";
@@ -54,19 +52,6 @@ const std::string kTermFieldName = "term";
const std::string kVoteGrantedFieldName = "voteGranted";
const std::string kOperationTime = "operationTime";
-// TODO: `kLegalArgsFieldNamesFCV42` should be removed after upgrading to 4.6 (SERVER-46090).
-const std::string kLegalArgsFieldNamesFCV42[] = {
- kCandidateIndexFieldName,
- kCommandName,
- kConfigVersionFieldName,
- kConfigTermFieldName,
- kDryRunFieldName,
- kLastDurableOpTimeFieldName,
- kSetNameFieldName,
- kTermFieldName,
- kOperationTime,
-};
-
const std::string kLegalArgsFieldNames[] = {
kCandidateIndexFieldName,
kCommandName,
@@ -85,24 +70,6 @@ const std::string kLegalArgsFieldNames[] = {
Status ReplSetRequestVotesArgs::initialize(const BSONObj& argsObj) {
Status status =
bsonCheckOnlyHasFieldsForCommand("ReplSetRequestVotes", argsObj, kLegalArgsFieldNames);
- // TODO: Remove this logic once we branch to 4.6 and can always assume
- // _usingLastAppliedOptimeFieldName to be true (SERVER-46090).
- // Since nodes in the replica set may have different values for FCV, we check that the legal
- // field names of either FCV 4.2 or 4.4 are present in the args obj.
- if (!status.isOK()) {
- status = bsonCheckOnlyHasFieldsForCommand(
- "ReplSetRequestVotes", argsObj, kLegalArgsFieldNamesFCV42);
- if (!status.isOK())
- return status;
-
- // If we successfully parsed with the FCV 4.2 field names, use 'lastCommittedOp' as the
- // correct field name.
- _usingLastAppliedOpTimeFieldName = false;
- } else {
- // If we successfully parsed with the FCV 4.4 field names, use 'lastAppliedOpTime' as the
- // correct field name.
- _usingLastAppliedOpTimeFieldName = true;
- }
status = bsonExtractIntegerField(argsObj, kTermFieldName, &_term);
if (!status.isOK())
@@ -131,13 +98,7 @@ Status ReplSetRequestVotesArgs::initialize(const BSONObj& argsObj) {
if (!status.isOK())
return status;
- // If we successfully parsed with the FCV 4.4 field names, use 'lastAppliedOpTime' to extract
- // the data. Else, use 'lastCommittedOp' as the field name.
- if (_usingLastAppliedOpTimeFieldName) {
- status = bsonExtractOpTimeField(argsObj, kLastAppliedOpTimeFieldName, &_lastAppliedOpTime);
- } else {
- status = bsonExtractOpTimeField(argsObj, kLastDurableOpTimeFieldName, &_lastAppliedOpTime);
- }
+ status = bsonExtractOpTimeField(argsObj, kLastAppliedOpTimeFieldName, &_lastAppliedOpTime);
if (!status.isOK()) {
return status;
}
@@ -185,11 +146,7 @@ void ReplSetRequestVotesArgs::addToBSON(BSONObjBuilder* builder) const {
builder->appendIntOrLL(kCandidateIndexFieldName, _candidateIndex);
builder->appendIntOrLL(kConfigVersionFieldName, _cfgVer);
builder->appendIntOrLL(kConfigTermFieldName, _cfgTerm);
- if (_usingLastAppliedOpTimeFieldName) {
- _lastAppliedOpTime.append(builder, kLastAppliedOpTimeFieldName);
- } else {
- _lastAppliedOpTime.append(builder, kLastDurableOpTimeFieldName);
- }
+ _lastAppliedOpTime.append(builder, kLastAppliedOpTimeFieldName);
}
std::string ReplSetRequestVotesArgs::toString() const {