diff options
author | Scott Hernandez <scotthernandez@tart.local> | 2016-03-10 17:30:13 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@tart.local> | 2016-03-11 08:26:43 -0500 |
commit | 4834c6b6965281b5f861e8df398ad285e3352e16 (patch) | |
tree | b5c9f6829e91dbb8ee54093e39d63cbfecece7b5 | |
parent | 6970fa3ab420f7ad0e5ca30af62d5d212715d2af (diff) | |
download | mongo-4834c6b6965281b5f861e8df398ad285e3352e16.tar.gz |
SERVER-23003: Wait for synctail to clear the buffer.
(cherry picked from commit 7a8fae34f9949fadc515c47d956bbbc464842664)
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 23b6fd97d39..6c69a0a3269 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -696,7 +696,17 @@ void BackgroundSync::_rollback(OperationContext* txn, RollbackSourceImpl(getConnection, source, rsOplogName), _replCoord); if (status.isOK()) { + // When the syncTail thread sees there is no new data by adding something to the buffer. _signalNoNewDataForApplier(); + // Wait until the buffer is emtpy. + // This is an indication that syncTail has removed the sentinal marker from the buffer + // and reset its local lastAppliedOpTime via the replCoord. + while (!_buffer.empty()) { + sleepmillis(10); + if (inShutdown()) { + return; + } + } return; } if (ErrorCodes::UnrecoverableRollbackError == status.code()) { |