[SERVER-45006] LockerImpl::wasGlobalLockTaken() always returns true Created: 06/Dec/19  Updated: 29/Oct/23  Resolved: 16/Jan/20

Status: Closed
Project: Core Server
Component/s: Replication, Storage
Affects Version/s: None
Fix Version/s: 4.2.4, 4.3.3

Type: Bug Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: Tess Avitabile (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-45007 PBWM acquisition in GlobalLock constr... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2
Steps To Reproduce:

diff --git a/src/mongo/db/concurrency/d_concurrency_test.cpp b/src/mongo/db/concurrency/d_concurrency_test.cpp
index c19883a2b1..6562b1667f 100644
--- a/src/mongo/db/concurrency/d_concurrency_test.cpp
+++ b/src/mongo/db/concurrency/d_concurrency_test.cpp
@@ -485,6 +485,12 @@ TEST_F(DConcurrencyTestFixture, GlobalLockXSetsGlobalWriteLockedOnOperationConte
     ASSERT_TRUE(opCtx->lockState()->wasGlobalLockTakenForWrite());
 }
 
+TEST_F(DConcurrencyTestFixture, WasGlobalLockTaken) {
+    auto clients = makeKClientsWithLockers(1);
+    auto opCtx = clients[0].second.get();
+    ASSERT_FALSE(opCtx->lockState()->wasGlobalLockTaken());
+}
+

Sprint: Repl 2020-01-27
Participants:
Linked BF Score: 14

 Description   

The only usage is here, for deciding whether to take a lock to collect storage stats. The intention was that commands that do not take locks should not take a lock for logging. Although that usage has a deadline in order to avoid deadlock, the PBWM acquisition does not respect the deadlock (SERVER-45007).



 Comments   
Comment by Githook User [ 29/Jan/20 ]

Author:

{'name': 'Tess Avitabile', 'username': 'tessavitabile', 'email': 'tess.avitabile@mongodb.com'}

Message: SERVER-45006 LockerImpl::wasGlobalLockTaken() returns correct value

(cherry picked from commit a60b866fa9c7b89e2fab3a60432f54ca0492be9f)
Branch: v4.2
https://github.com/mongodb/mongo/commit/3c9c48e7f81af7dd799841a062789915d77a0033

Comment by Githook User [ 16/Jan/20 ]

Author:

{'name': 'Tess Avitabile', 'email': 'tess.avitabile@mongodb.com', 'username': 'tessavitabile'}

Message: SERVER-45006 LockerImpl::wasGlobalLockTaken() returns correct value
Branch: master
https://github.com/mongodb/mongo/commit/a60b866fa9c7b89e2fab3a60432f54ca0492be9f

Generated at Thu Feb 08 05:07:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.