diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-11-28 11:34:44 -0500 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-12-10 17:28:04 -0500 |
commit | 6f23d1a20a7669396efab06bf26b3ee76553fd9b (patch) | |
tree | 7338658c77438493ac1cec732cb00570a9e71b85 /src/mongo/db/repl/rs_rollback.cpp | |
parent | ef7a91c26cdfd85f1d170219a724c16edaab6b9c (diff) | |
download | mongo-6f23d1a20a7669396efab06bf26b3ee76553fd9b.tar.gz |
SERVER-37897 Disable table logging for data files when enableMajorityReadConcern=false
Diffstat (limited to 'src/mongo/db/repl/rs_rollback.cpp')
-rw-r--r-- | src/mongo/db/repl/rs_rollback.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index 69e9286b649..6eeb980f5a6 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -1405,6 +1405,21 @@ void rollback_internal::syncFixUp(OperationContext* opCtx, log() << "Rollback deleted " << deletes << " documents and updated " << updates << " documents."; + // When majority read concern is disabled, the stable timestamp may be ahead of the common + // point. Force the stable timestamp back to the common point. + if (!serverGlobalParams.enableMajorityReadConcern) { + const bool force = true; + log() << "Forcing the stable timestamp to " << fixUpInfo.commonPoint.getTimestamp(); + opCtx->getServiceContext()->getStorageEngine()->setStableTimestamp( + fixUpInfo.commonPoint.getTimestamp(), boost::none, force); + + // We must wait for a checkpoint before truncating oplog, so that if we crash after + // truncating oplog, we are guaranteed to recover from a checkpoint that includes all of the + // writes performed during the rollback. + log() << "Waiting for a stable checkpoint"; + opCtx->recoveryUnit()->waitUntilUnjournaledWritesDurable(); + } + log() << "Truncating the oplog at " << fixUpInfo.commonPoint.toString() << " (" << fixUpInfo.commonPointOurDiskloc << "), non-inclusive"; |