summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog/dist_lock_manager.h
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2016-04-19 09:47:07 -0400
committerDianna Hohensee <dianna.hohensee@10gen.com>2016-04-20 09:33:14 -0400
commit22082d01a15a589398f3db6f9357dedd1a4c73fe (patch)
treed02fa995fbe03d8646588517230a2f569c6a2d28 /src/mongo/s/catalog/dist_lock_manager.h
parent87f4add785d14f1f4966064efc25d84afbe937fc (diff)
downloadmongo-22082d01a15a589398f3db6f9357dedd1a4c73fe.tar.gz
SERVER-23667 can overtake locks by using the same lockSessionID as the lock owner, via DistLockManager::lockWithSessionID
Diffstat (limited to 'src/mongo/s/catalog/dist_lock_manager.h')
-rw-r--r--src/mongo/s/catalog/dist_lock_manager.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/s/catalog/dist_lock_manager.h b/src/mongo/s/catalog/dist_lock_manager.h
index e06b2b9eac8..3b60c4a09bd 100644
--- a/src/mongo/s/catalog/dist_lock_manager.h
+++ b/src/mongo/s/catalog/dist_lock_manager.h
@@ -138,6 +138,22 @@ public:
stdx::chrono::milliseconds lockTryInterval = kDefaultLockRetryInterval) = 0;
/**
+ * Same behavior as lock(...) above, except takes a specific lock session ID "lockSessionID"
+ * instead of randomly generating one internally.
+ *
+ * This is useful for a process running on the config primary after a failover. A lock can be
+ * immediately reacquired if "lockSessionID" matches that of the lock, rather than waiting for
+ * the inactive lock to expire.
+ */
+ virtual StatusWith<ScopedDistLock> lockWithSessionID(
+ OperationContext* txn,
+ StringData name,
+ StringData whyMessage,
+ const OID lockSessionID,
+ stdx::chrono::milliseconds waitFor = kDefaultLockTimeout,
+ stdx::chrono::milliseconds lockTryInterval = kDefaultLockRetryInterval) = 0;
+
+ /**
* Makes a best-effort attempt to unlock all locks owned by the given processID.
* Only implemented for the ReplSetDistLockManager and only used after catalog manager swap
* during upgrade to CSRS.