summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@mongodb.com>2023-05-10 13:38:39 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-16 22:01:20 +0000
commit00635530f8dd4d98d765de4c215a495c49036d16 (patch)
tree7b174f76b082c885e3a37667474dd48891e77558
parent9354aa6ccf769929ed3e7bd09f0dd95f8ab3a2a2 (diff)
downloadmongo-00635530f8dd4d98d765de4c215a495c49036d16.tar.gz
SERVER-76987 Make oplog notification robust to step-up
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index 7c7640c7be5..ea28a21a1f3 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -516,6 +516,10 @@ OpTime ReplicationCoordinatorExternalStateImpl::onTransitionToPrimary(OperationC
<< ReplicationCoordinator::newPrimaryMsg));
wuow.commit();
});
+ // As far as the storage system is concerned, we're still secondary here, and will be until we
+ // change readWriteAbility. So new and resumed lock-free reads will read from lastApplied. We
+ // just advanced lastApplied by writing the no-op, so we need to signal oplog waiters.
+ signalOplogWaiters();
const auto loadLastOpTimeAndWallTimeResult = loadLastOpTimeAndWallTime(opCtx);
fassert(28665, loadLastOpTimeAndWallTimeResult);
auto opTimeToReturn = loadLastOpTimeAndWallTimeResult.getValue().opTime;