diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2014-09-29 18:35:00 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2014-10-06 14:15:09 -0400 |
commit | af7bd821ac444f7b733545ad9d26e860c7f6b978 (patch) | |
tree | 5b74cf24875c133321b90970dd75a5751e4a3381 /src/mongo/db/repl/elect_cmd_runner.cpp | |
parent | ab4b43b75c42ce894b01043b8f82a5a9d070419c (diff) | |
download | mongo-af7bd821ac444f7b733545ad9d26e860c7f6b978.tar.gz |
SERVER-15458 Change ElectCmdRunner to use an OID for election rounds, not a long long.
Diffstat (limited to 'src/mongo/db/repl/elect_cmd_runner.cpp')
-rw-r--r-- | src/mongo/db/repl/elect_cmd_runner.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/repl/elect_cmd_runner.cpp b/src/mongo/db/repl/elect_cmd_runner.cpp index a0e70c76acf..8cb7dad55bd 100644 --- a/src/mongo/db/repl/elect_cmd_runner.cpp +++ b/src/mongo/db/repl/elect_cmd_runner.cpp @@ -46,7 +46,7 @@ namespace repl { const ReplicaSetConfig& rsConfig, int selfIndex, const std::vector<HostAndPort>& targets, - long long round) + OID round) : _actualResponses(0), _sufficientResponsesReceived(false), _rsConfig(rsConfig), @@ -96,6 +96,9 @@ namespace repl { if (_receivedVotes >= _rsConfig.getMajorityNumber()) { return true; } + if (_receivedVotes < 0) { + return true; + } if (_actualResponses == _targets.size()) { return true; } @@ -137,8 +140,7 @@ namespace repl { const std::vector<HostAndPort>& targets, const stdx::function<void ()>& onCompletion) { - const long long round(executor->nextRandomInt64(std::numeric_limits<int64_t>::max())); - _algorithm.reset(new Algorithm(currentConfig, selfIndex, targets, round)); + _algorithm.reset(new Algorithm(currentConfig, selfIndex, targets, OID::gen())); _runner.reset(new ScatterGatherRunner(_algorithm.get())); return _runner->start(executor, onCompletion); } |