summaryrefslogtreecommitdiff
path: root/src/mongo/s/distlock.h
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-04-15 13:58:21 -0400
committerRandolph Tan <randolph@10gen.com>2014-04-17 11:07:03 -0400
commit5e737823b0cd4e56e894fb504c406caa28d8fd34 (patch)
tree7fef0b4a786830dabb6f769bf68ede90e3dc2f22 /src/mongo/s/distlock.h
parent9ec25e399fc775361ed37fd5abb78960659a308b (diff)
downloadmongo-5e737823b0cd4e56e894fb504c406caa28d8fd34.tar.gz
SERVER-13585 Race in dist lock after winning "tournament" round
Remove the potential state transition from 1 to 0.
Diffstat (limited to 'src/mongo/s/distlock.h')
-rw-r--r--src/mongo/s/distlock.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/s/distlock.h b/src/mongo/s/distlock.h
index 583460fdf54..75595dc273a 100644
--- a/src/mongo/s/distlock.h
+++ b/src/mongo/s/distlock.h
@@ -71,6 +71,19 @@ namespace mongo {
* (1) remembering the ping document time along with config server time when unable to
* take a lock, and (2) ensuring all config servers report similar times and have similar
* time rates (the difference in times must start and stay small).
+ *
+ * Lock states include:
+ * 0: unlocked
+ * 1: about to be locked
+ * 2: locked
+ *
+ * Valid state transitions:
+ * 0 -> 1
+ * 1 -> 2
+ * 2 -> 0
+ *
+ * Note that at any point in time, a lock can be force unlocked if the ping for the lock
+ * becomes too stale.
*/
class MONGO_CLIENT_API DistributedLock {
public: