diff options
author | Geert Bosch <geert@mongodb.com> | 2017-12-08 17:52:41 -0500 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2018-01-03 18:50:43 -0500 |
commit | 3dd94e853f1f6e682cad15fdc3c4b1351cfca2c9 (patch) | |
tree | 902e31a4b719ddb097a6c65cb4d620f4d55b637c | |
parent | 1c87ee469b8b4300951488a0b96b20bbef1366e2 (diff) | |
download | mongo-3dd94e853f1f6e682cad15fdc3c4b1351cfca2c9.tar.gz |
SERVER-32242 Fix race in CompatibleFirstStress lock manager test
(cherry picked from commit cc13cb76a07a01cb0eb14bd4516a9ef9c073f1c7)
-rw-r--r-- | src/mongo/db/concurrency/d_concurrency_test.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/concurrency/lock_state.cpp | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/concurrency/d_concurrency_test.cpp b/src/mongo/db/concurrency/d_concurrency_test.cpp index 77aaadc8355..2b62a387ce7 100644 --- a/src/mongo/db/concurrency/d_concurrency_test.cpp +++ b/src/mongo/db/concurrency/d_concurrency_test.cpp @@ -1169,10 +1169,7 @@ TEST_F(DConcurrencyTestFixture, CompatibleFirstStress) { // MODE_IS or MODE_S lock, the CompatibleFirst policy guarantees success. auto newInterval = readOnlyInterval.load(); invariant(!interval || interval != newInterval || lock->isLocked()); - interval = newInterval; lock->waitForLock(0); - newInterval = readOnlyInterval.load(); - invariant(!interval || interval != newInterval || lock->isLocked()); break; } case 5: diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp index 2b5133e34a6..33e1f0cb473 100644 --- a/src/mongo/db/concurrency/lock_state.cpp +++ b/src/mongo/db/concurrency/lock_state.cpp @@ -785,7 +785,10 @@ LockResult LockerImpl<IsForMMAPV1>::lockComplete(ResourceId resId, } } - // Cleanup the state, since this is an unused lock now + // Cleanup the state, since this is an unused lock now. + // Note: in case of the _notify object returning LOCK_TIMEOUT, it is possible to find that the + // lock was still granted after all, but we don't try to take advantage of that and will return + // a timeout. if (result != LOCK_OK) { LockRequestsMap::Iterator it = _requests.find(resId); _unlockImpl(&it); |