diff options
-rw-r--r-- | src/mongo/db/write_concern.cpp | 3 | ||||
-rw-r--r-- | src/mongo/s/catalog/dist_lock_catalog_impl.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp | 16 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp index cbac6129001..7ced5c064cf 100644 --- a/src/mongo/db/write_concern.cpp +++ b/src/mongo/db/write_concern.cpp @@ -68,7 +68,8 @@ namespace { void addJournalSyncForWMajority(WriteConcernOptions* writeConcern) { if (repl::getGlobalReplicationCoordinator()->isV1ElectionProtocol() && writeConcern->wMode == WriteConcernOptions::kMajority && - writeConcern->syncMode == WriteConcernOptions::NONE) { + writeConcern->syncMode == WriteConcernOptions::NONE && + getGlobalServiceContext()->getGlobalStorageEngine()->isDurable()) { writeConcern->syncMode = WriteConcernOptions::JOURNAL; } } diff --git a/src/mongo/s/catalog/dist_lock_catalog_impl.cpp b/src/mongo/s/catalog/dist_lock_catalog_impl.cpp index cf91b52f007..f7a53fe2e54 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_impl.cpp +++ b/src/mongo/s/catalog/dist_lock_catalog_impl.cpp @@ -142,7 +142,10 @@ DistLockCatalogImpl::DistLockCatalogImpl(ShardRegistry* shardRegistry, Milliseconds writeConcernTimeout) : _client(shardRegistry), _writeConcern(WriteConcernOptions(WriteConcernOptions::kMajority, - WriteConcernOptions::JOURNAL, + // Note: Even though we're setting NONE here, + // kMajority implies JOURNAL, if journaling is supported + // by this mongod. + WriteConcernOptions::NONE, writeConcernTimeout.count())), _lockPingNS(LockpingsType::ConfigNS), _locksNS(LocksType::ConfigNS) {} diff --git a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp index 456ecaa70ba..f2bfd5b5331 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp +++ b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp @@ -153,7 +153,7 @@ TEST_F(DistLockCatalogFixture, BasicPing) { } }, upsert: true, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -306,7 +306,7 @@ TEST_F(DistLockCatalogFixture, GrabLockNoOp) { }, upsert: true, new: true, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -352,7 +352,7 @@ TEST_F(DistLockCatalogFixture, GrabLockWithNewDoc) { }, upsert: true, new: true, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -589,7 +589,7 @@ TEST_F(DistLockCatalogFixture, OvertakeLockNoOp) { } }, new: true, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -641,7 +641,7 @@ TEST_F(DistLockCatalogFixture, OvertakeLockWithNewDoc) { } }, new: true, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -827,7 +827,7 @@ TEST_F(DistLockCatalogFixture, BasicUnlock) { findAndModify: "locks", query: { ts: ObjectId("555f99712c99a78c5b083358") }, update: { $set: { state: 0 }}, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -859,7 +859,7 @@ TEST_F(DistLockCatalogFixture, UnlockWithNoNewDoc) { findAndModify: "locks", query: { ts: ObjectId("555f99712c99a78c5b083358") }, update: { $set: { state: 0 }}, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); @@ -1138,7 +1138,7 @@ TEST_F(DistLockCatalogFixture, BasicStopPing) { findAndModify: "lockpings", query: { _id: "test" }, remove: true, - writeConcern: { w: "majority", j: true, wtimeout: 100 } + writeConcern: { w: "majority", wtimeout: 100 } })")); ASSERT_EQUALS(expectedCmd, request.cmdObj); |