diff options
author | Eric Milkie <milkie@10gen.com> | 2014-09-30 09:12:26 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2014-10-01 14:48:12 -0400 |
commit | a8d2bfcc9b76cef2d133bdd786361efb3fb20e59 (patch) | |
tree | 6f4655df5dac4732199439a678ed7683feb6686b /src/mongo/db/repl/bgsync.cpp | |
parent | 91ba5436c2681a194bd92fff852b4afca61bdde7 (diff) | |
download | mongo-a8d2bfcc9b76cef2d133bdd786361efb3fb20e59.tar.gz |
SERVER-15404 SERVER-15466 Hook up Applier draining and force syncing to new Replication Coordinator Impl
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 9a5e71cfb61..302e6e08df5 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -129,6 +129,7 @@ namespace { // If all ops in the buffer have been applied, unblock waitForRepl (if it's waiting) if (_buffer.empty()) { _appliedBuffer = true; + _replCoord->signalDrainComplete(); _condvar.notify_all(); } } @@ -154,10 +155,10 @@ namespace { } void BackgroundSync::_producerThread() { - MemberState state = theReplSet->state(); + MemberState state = _replCoord->getCurrentMemberState(); // we want to pause when the state changes to primary - if (isAssumingPrimary() || state.primary()) { + if (_replCoord->isWaitingForApplierToDrain() || state.primary()) { if (!_pause) { stop(); } @@ -264,13 +265,11 @@ namespace { // sleepmillis(SleepToAllowBatchingMillis); } - - if (theReplSet->gotForceSync()) { - return; - } + // If we are transitioning to primary state, we need to leave // this loop in order to go into bgsync-pause mode. - if (isAssumingPrimary() || theReplSet->isPrimary()) { + if (_replCoord->isWaitingForApplierToDrain() || + _replCoord->getCurrentMemberState().primary()) { return; } @@ -464,8 +463,7 @@ namespace { " " << _lastFetchedHash << rsLog; } - bool BackgroundSync::isAssumingPrimary() { - boost::unique_lock<boost::mutex> lck(_mutex); + bool BackgroundSync::isAssumingPrimary_inlock() { return _assumingPrimary; } |