summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2020-02-13 19:39:27 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-14 21:17:39 +0000
commit04a2c9acc7ca061fb86736b377b897b11f6c7c48 (patch)
treeb224ee11f08e9873ce42d698875717c1e9c73197 /src
parent6d163783f03e07a172154eaa0fa270c3c05c4d08 (diff)
downloadmongo-04a2c9acc7ca061fb86736b377b897b11f6c7c48.tar.gz
SERVER-45178 Always update rollbackId before truncating oplog for rollback-via-refetch
create mode 100644 jstests/replsets/rollback_via_refetch_update_rollback_id_before_oplog_truncation.js
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index aad64b6db3c..f11d195259d 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -1244,10 +1244,11 @@ Status _syncRollback(OperationContext* opCtx,
invariant(commonPoint >= committedSnapshot);
try {
- ON_BLOCK_EXIT([&] {
- auto status = replicationProcess->incrementRollbackID(opCtx);
- fassert(40497, status);
- });
+ // It is always safe to increment the rollback ID first, even if we fail to complete
+ // the rollback.
+ auto status = replicationProcess->incrementRollbackID(opCtx);
+ fassert(40497, status);
+
syncFixUp(opCtx, how, rollbackSource, replCoord, replicationProcess);
if (MONGO_unlikely(rollbackExitEarlyAfterCollectionDrop.shouldFail())) {