diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-11-13 12:12:01 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-11-13 21:26:24 -0500 |
commit | 0962abcb99b52b6a9d4d03e7980569a7933394b3 (patch) | |
tree | a89a2be2255e381bc1abd4128551ac5643a67fda /src/mongo/db/concurrency/lock_state.cpp | |
parent | 60bde0565d251463b50cee23b49a025d78e2278d (diff) | |
download | mongo-0962abcb99b52b6a9d4d03e7980569a7933394b3.tar.gz |
SERVER-16067 Split new lock acquisition and conversion into two methods
This makes it clear where we do acquisitions and conversions and we can do
less work and decision making while holding the Lock Manager's bucket
mutex.
Diffstat (limited to 'src/mongo/db/concurrency/lock_state.cpp')
-rw-r--r-- | src/mongo/db/concurrency/lock_state.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp index 93b9cb8736d..ca204b68a36 100644 --- a/src/mongo/db/concurrency/lock_state.cpp +++ b/src/mongo/db/concurrency/lock_state.cpp @@ -685,6 +685,7 @@ namespace mongo { template<bool IsForMMAPV1> LockResult LockerImpl<IsForMMAPV1>::lockImpl(const ResourceId& resId, LockMode mode) { LockRequest* request; + bool isNew = true; LockRequestsMap::Iterator it = _requests.find(resId); if (!it) { @@ -696,6 +697,7 @@ namespace mongo { } else { request = it.objAddr(); + isNew = false; } // Give priority to the full modes for global and flush lock so we don't stall global @@ -709,7 +711,8 @@ namespace mongo { _notify.clear(); - return globalLockManager.lock(resId, request, mode); + return isNew ? globalLockManager.lock(resId, request, mode) : + globalLockManager.convert(resId, request, mode); } template<bool IsForMMAPV1> |