summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/repl_set_config.h
diff options
context:
space:
mode:
authorPavithra Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-01-21 16:00:44 +0000
committerevergreen <evergreen@mongodb.com>2020-01-21 16:00:44 +0000
commit202dacee3f31ea539c86e9d818d9bc584b3d54c3 (patch)
tree2007849fee0aa1bcdb92f12195156efe23942664 /src/mongo/db/repl/repl_set_config.h
parentf6622508476deda1bbee51247a4ac6118f121440 (diff)
downloadmongo-202dacee3f31ea539c86e9d818d9bc584b3d54c3.tar.gz
SERVER-45078 Ignore term in configs provided by replSetReconfig command
Diffstat (limited to 'src/mongo/db/repl/repl_set_config.h')
-rw-r--r--src/mongo/db/repl/repl_set_config.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/repl/repl_set_config.h b/src/mongo/db/repl/repl_set_config.h
index 4bf779fe76f..66075c5c105 100644
--- a/src/mongo/db/repl/repl_set_config.h
+++ b/src/mongo/db/repl/repl_set_config.h
@@ -79,12 +79,17 @@ public:
/**
* Initializes this ReplSetConfig from the contents of "cfg".
* Sets _replicaSetId to "defaultReplicaSetId" if a replica set ID is not specified in "cfg".
+ * If forceTerm is not boost::none, sets _term to the given term. Otherwise, parses term from
+ * config BSON.
*/
- Status initialize(const BSONObj& cfg, OID defaultReplicaSetId = OID());
+ Status initialize(const BSONObj& cfg,
+ boost::optional<long long> forceTerm = boost::none,
+ OID defaultReplicaSetId = OID());
/**
* Same as the generic initialize() above except will default "configsvr" setting to the value
* of serverGlobalParams.configsvr.
+ * Sets _term to kInitialTerm.
*/
Status initializeForInitiate(const BSONObj& cfg);
@@ -419,8 +424,13 @@ private:
/**
* Sets replica set ID to 'defaultReplicaSetId' if forInitiate is false and 'cfg' does not
* contain an ID.
+ * Sets _term to kInitialTerm for initiate.
+ * Sets _term to forceTerm if it is not boost::none. Otherwise, parses term from 'cfg'.
*/
- Status _initialize(const BSONObj& cfg, bool forInitiate, OID defaultReplicaSetId);
+ Status _initialize(const BSONObj& cfg,
+ bool forInitiate,
+ boost::optional<long long> forceTerm,
+ OID defaultReplicaSetId);
bool _isInitialized = false;
long long _version = 1;