diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2016-03-08 19:40:54 -0500 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2016-04-12 16:54:42 -0400 |
commit | ded60f5d4254f08d76ccdf0d3a694d473bd14100 (patch) | |
tree | 585cd96ce9dbfc9d23e6a66911e33f464e87edf1 /src/mongo/db/repl/vote_requester.cpp | |
parent | 51abe7d21b799a3758ce71d18ac7d6a088f71e2c (diff) | |
download | mongo-ded60f5d4254f08d76ccdf0d3a694d473bd14100.tar.gz |
SERVER-22995 Protect TopoCoord with mutex rather than single thread executor.
Move scatter gather runner out of executor and protect the runner with its own mutex.
Replace onComplete with callbacks scheduled on finish event.
Diffstat (limited to 'src/mongo/db/repl/vote_requester.cpp')
-rw-r--r-- | src/mongo/db/repl/vote_requester.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/mongo/db/repl/vote_requester.cpp b/src/mongo/db/repl/vote_requester.cpp index eafa68715e2..836617e5493 100644 --- a/src/mongo/db/repl/vote_requester.cpp +++ b/src/mongo/db/repl/vote_requester.cpp @@ -141,22 +141,20 @@ unordered_set<HostAndPort> VoteRequester::Algorithm::getResponders() const { VoteRequester::VoteRequester() : _isCanceled(false) {} VoteRequester::~VoteRequester() {} -StatusWith<ReplicationExecutor::EventHandle> VoteRequester::start( - ReplicationExecutor* executor, - const ReplicaSetConfig& rsConfig, - long long candidateIndex, - long long term, - bool dryRun, - OpTime lastDurableOpTime, - const stdx::function<void()>& onCompletion) { +StatusWith<ReplicationExecutor::EventHandle> VoteRequester::start(ReplicationExecutor* executor, + const ReplicaSetConfig& rsConfig, + long long candidateIndex, + long long term, + bool dryRun, + OpTime lastDurableOpTime) { _algorithm.reset(new Algorithm(rsConfig, candidateIndex, term, dryRun, lastDurableOpTime)); - _runner.reset(new ScatterGatherRunner(_algorithm.get())); - return _runner->start(executor, onCompletion); + _runner.reset(new ScatterGatherRunner(_algorithm.get(), executor)); + return _runner->start(); } -void VoteRequester::cancel(ReplicationExecutor* executor) { +void VoteRequester::cancel() { _isCanceled = true; - _runner->cancel(executor); + _runner->cancel(); } VoteRequester::Result VoteRequester::getResult() const { |