diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_mock.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/write_concern_options.h | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index d7f37369a35..abd758040f0 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -2784,6 +2784,7 @@ TEST_F(ReplCoordTest, AwaitReplicationShouldResolveAsNormalDuringAReconfig) { WriteConcernOptions writeConcern; writeConcern.wTimeout = WriteConcernOptions::kNoTimeout; writeConcern.wNumNodes = 3; + writeConcern.syncMode = WriteConcernOptions::SyncMode::NONE; ReplicationAwaiter awaiter(getReplCoord(), &txn); awaiter.setOpTime(time); @@ -2932,6 +2933,7 @@ TEST_F(ReplCoordTest, WriteConcernOptions writeConcern; writeConcern.wTimeout = WriteConcernOptions::kNoTimeout; writeConcern.wMode = WriteConcernOptions::kMajority; + writeConcern.syncMode = WriteConcernOptions::SyncMode::NONE; ReplicationAwaiter awaiter(getReplCoord(), &txn); awaiter.setOpTime(time); @@ -2942,6 +2944,8 @@ TEST_F(ReplCoordTest, WriteConcernOptions writeConcern2; writeConcern2.wTimeout = WriteConcernOptions::kNoWaiting; writeConcern2.wMode = WriteConcernOptions::kMajority; + writeConcern.syncMode = WriteConcernOptions::SyncMode::NONE; + ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, getReplCoord()->awaitReplication(&txn, time, writeConcern2).status); diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp index 2ceb947cb8e..3ea4d8eef42 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_mock.cpp @@ -432,7 +432,11 @@ size_t ReplicationCoordinatorMock::getNumUncommittedSnapshots() { WriteConcernOptions ReplicationCoordinatorMock::populateUnsetWriteConcernOptionsSyncMode( WriteConcernOptions wc) { if (wc.syncMode == WriteConcernOptions::SyncMode::UNSET) { - wc.syncMode = WriteConcernOptions::SyncMode::JOURNAL; + if (wc.wMode == WriteConcernOptions::kMajority) { + wc.syncMode = WriteConcernOptions::SyncMode::JOURNAL; + } else { + wc.syncMode = WriteConcernOptions::SyncMode::NONE; + } } return wc; } diff --git a/src/mongo/db/write_concern_options.h b/src/mongo/db/write_concern_options.h index 91320b0d39a..0c187ed2887 100644 --- a/src/mongo/db/write_concern_options.h +++ b/src/mongo/db/write_concern_options.h @@ -51,9 +51,6 @@ public: WriteConcernOptions() { reset(); - // We set syncMode to NONE to avoid having an UNSET syncMode in default WriteConcernOptions - // since that can cause invariants to trigger. - syncMode = SyncMode::NONE; } WriteConcernOptions(int numNodes, SyncMode sync, int timeout); |