diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2022-05-25 12:40:40 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-26 13:38:04 +0000 |
commit | faf655827b3acedf1513bc140e753a5556f2e5a3 (patch) | |
tree | 381376cad1e209bd41bb7ba34a943ae6a86e5510 | |
parent | 78889bdd2b6c6180483d97e5fa220aa660f23a03 (diff) | |
download | mongo-faf655827b3acedf1513bc140e753a5556f2e5a3.tar.gz |
SERVER-66719 Take FCV lock in `MODE_IS` for shared global lock modesr5.3.2-rc2r5.3.2
(cherry picked from commit 1c3268ae7fd8ffd678c20d5f2ac977be2a2c982f)
-rw-r--r-- | etc/backports_required_for_multiversion_tests.yml | 4 | ||||
-rw-r--r-- | jstests/replsets/dbhash_lock_acquisition.js | 9 | ||||
-rw-r--r-- | src/mongo/db/concurrency/d_concurrency.cpp | 10 |
3 files changed, 13 insertions, 10 deletions
diff --git a/etc/backports_required_for_multiversion_tests.yml b/etc/backports_required_for_multiversion_tests.yml index 3b02094cea7..660cd9d94a3 100644 --- a/etc/backports_required_for_multiversion_tests.yml +++ b/etc/backports_required_for_multiversion_tests.yml @@ -156,7 +156,7 @@ last-continuous: test_file: jstests/replsets/apply_ops_dropDatabase.js - ticket: SERVER-64485 test_file: jstests/sharding/update_with_dollar_fields.js - - ticket: SERVER-65821 + - ticket: SERVER-66719 test_file: jstests/replsets/dbhash_lock_acquisition.js - ticket: SERVER-64780 test_file: jstest/sharding/resharding_change_stream_namespace_filtering.js @@ -457,7 +457,7 @@ last-lts: test_file: jstests/sharding/update_with_dollar_fields.js - ticket: SERVER-63531 test_file: jstests/replsets/buildindexes_false_commit_quorum.js - - ticket: SERVER-65821 + - ticket: SERVER-66719 test_file: jstests/replsets/dbhash_lock_acquisition.js # Tests that should only be excluded from particular suites should be listed under that suite. diff --git a/jstests/replsets/dbhash_lock_acquisition.js b/jstests/replsets/dbhash_lock_acquisition.js index 594df5dc8e0..bb4a73b11b0 100644 --- a/jstests/replsets/dbhash_lock_acquisition.js +++ b/jstests/replsets/dbhash_lock_acquisition.js @@ -85,8 +85,13 @@ assert.soon(() => { if (ops.length === 0) { return false; } - assert.eq(ops[0].locks, - {ReplicationStateTransition: "w", Global: "r", Database: "r", Collection: "r"}); + assert.eq(ops[0].locks, { + FeatureCompatibilityVersion: "r", + ReplicationStateTransition: "w", + Global: "r", + Database: "r", + Collection: "r", + }); return true; }, () => "Failed to find create collection in currentOp() output: " + tojson(db.currentOp())); diff --git a/src/mongo/db/concurrency/d_concurrency.cpp b/src/mongo/db/concurrency/d_concurrency.cpp index d63ac182dc1..6d002a08ff8 100644 --- a/src/mongo/db/concurrency/d_concurrency.cpp +++ b/src/mongo/db/concurrency/d_concurrency.cpp @@ -149,13 +149,11 @@ Lock::GlobalLock::GlobalLock(OperationContext* opCtx, } }); - if (_opCtx->lockState()->shouldConflictWithSetFeatureCompatibilityVersion() && - !isSharedLockMode(lockMode)) { - _fcvLock.lock(_opCtx, MODE_IX, deadline); + if (_opCtx->lockState()->shouldConflictWithSetFeatureCompatibilityVersion()) { + _fcvLock.lock(_opCtx, isSharedLockMode(lockMode) ? MODE_IS : MODE_IX, deadline); } - ScopeGuard unlockFCVLock([this, lockMode] { - if (_opCtx->lockState()->shouldConflictWithSetFeatureCompatibilityVersion() && - !isSharedLockMode(lockMode)) { + ScopeGuard unlockFCVLock([this] { + if (_opCtx->lockState()->shouldConflictWithSetFeatureCompatibilityVersion()) { _fcvLock.unlock(); } }); |