summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replica_set_config.h
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2015-08-12 08:58:34 -0400
committermatt dannenberg <matt.dannenberg@10gen.com>2015-08-13 04:16:32 -0400
commit7e3b287e3f829323a06b397eb927d7316efd6629 (patch)
treefcae34318541729e65392d58690fdd7b1057f7a2 /src/mongo/db/repl/replica_set_config.h
parent312fe328972341c071516b2e92227325471293ea (diff)
downloadmongo-7e3b287e3f829323a06b397eb927d7316efd6629.tar.gz
SERVER-19637 add election timeout to replica set config
Diffstat (limited to 'src/mongo/db/repl/replica_set_config.h')
-rw-r--r--src/mongo/db/repl/replica_set_config.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/mongo/db/repl/replica_set_config.h b/src/mongo/db/repl/replica_set_config.h
index f1c60bd2b05..474c06010c7 100644
--- a/src/mongo/db/repl/replica_set_config.h
+++ b/src/mongo/db/repl/replica_set_config.h
@@ -60,13 +60,10 @@ public:
static const size_t kMaxVotingMembers = 7;
// TODO: Consider returning different default heartbeat interval based on protocol version.
+ static const Milliseconds kDefaultElectionTimeoutPeriod;
static const Milliseconds kDefaultHeartbeatInterval;
static const Seconds kDefaultHeartbeatTimeoutPeriod;
- ReplicaSetConfig();
- std::string asBson() {
- return "";
- }
/**
* Initializes this ReplicaSetConfig from the contents of "cfg".
*/
@@ -177,6 +174,14 @@ public:
Milliseconds getHeartbeatInterval() const;
/**
+ * Gets the timeout for determining when the current PRIMARY is dead, which triggers a node to
+ * run for election.
+ */
+ Milliseconds getElectionTimeoutPeriod() const {
+ return _electionTimeoutPeriod;
+ }
+
+ /**
* Gets the amount of time to wait for a response to hearbeats sent to other
* nodes in the replica set.
*/
@@ -288,21 +293,22 @@ private:
*/
void _addInternalWriteConcernModes();
- bool _isInitialized;
+ bool _isInitialized = false;
long long _version;
std::string _replSetName;
std::vector<MemberConfig> _members;
WriteConcernOptions _defaultWriteConcern;
- Milliseconds _heartbeatInterval;
- Seconds _heartbeatTimeoutPeriod;
+ Milliseconds _electionTimeoutPeriod = Milliseconds(2000);
+ Milliseconds _heartbeatInterval = kDefaultHeartbeatInterval;
+ Seconds _heartbeatTimeoutPeriod = Seconds(0);
bool _chainingAllowed;
int _majorityVoteCount;
int _writeMajority;
int _totalVotingMembers;
ReplicaSetTagConfig _tagConfig;
StringMap<ReplicaSetTagPattern> _customWriteConcernModes;
- long long _protocolVersion;
- bool _configServer;
+ long long _protocolVersion = 0;
+ bool _configServer = false;
};