summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 1157a7b07fb..1ca21e6a074 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -1343,25 +1343,22 @@ bool ReplicationCoordinatorImpl::_doneWaitingForReplication_inlock(
StringData patternName;
if (writeConcern.wMode == WriteConcernOptions::kMajority) {
- if (useDurableOpTime && _externalState->snapshotsEnabled()) {
- // Make sure we have a valid snapshot.
+ if (_externalState->snapshotsEnabled()) {
+ // Make sure we have a valid "committed" snapshot up to the needed optime.
if (!_currentCommittedSnapshot) {
return false;
}
- if (getWriteConcernMajorityShouldJournal_inlock()) {
- // Wait for the "current" snapshot to advance to/past the opTime.
-
- const auto haveSnapshot = (_currentCommittedSnapshot->opTime >= opTime &&
- _currentCommittedSnapshot->name >= minSnapshot);
- if (!haveSnapshot) {
- log() << "Required snapshot optime: " << opTime << " is not yet part of the "
- << "current snapshot: " << *_currentCommittedSnapshot;
- }
- // We cannot have this committed snapshot until we have replicated to a majority,
- // so we can return true here once that requirement is met for durable writes.
- return haveSnapshot;
+ // Wait for the "current" snapshot to advance to/past the opTime.
+ const auto haveSnapshot = (_currentCommittedSnapshot->opTime >= opTime &&
+ _currentCommittedSnapshot->name >= minSnapshot);
+ if (!haveSnapshot) {
+ LOG(1) << "Required snapshot optime: " << opTime << " is not yet part of the "
+ << "current 'committed' snapshot: " << *_currentCommittedSnapshot;
+ return false;
}
+
+ // Fallthrough to wait for "majority" write concern.
}
// Continue and wait for replication to the majority (of voters).
// *** Needed for J:True, writeConcernMajorityShouldJournal:False (appliedOpTime snapshot).