Details
Description
In order to enable new config primaries to immediately gain access to the locks held by the old config primary, rather than waiting around for locks to expire, the lockSessionID must be specifiable and not always random so that the new primary knows what it is.
Current signature:
StatusWith<DistLockManager::ScopedDistLock> ReplSetDistLockManager::lock(
|
OperationContext* txn,
|
StringData name,
|
StringData whyMessage,
|
milliseconds waitFor,
|
milliseconds lockTryInterval);
|
Add new function:
StatusWith<DistLockManager::ScopedDistLock> ReplSetDistLockManager::lockWithSessionID(
|
OperationContext* txn,
|
StringData name,
|
StringData whyMessage,
|
milliseconds waitFor,
|
milliseconds lockTryInterval,
|
OID lockSessionID);
|
ReplSetDistLockManager::lock will generate a OID and call ReplSetDistLockManager::lockWithSessionID, which will contain all the current implementation with the modification of not generating the lockSessionID that it now receives and comparing the lockSessionID to the lock's session ID to check whether the lock can be overtaken on a match.