Implement lock for multiple watchers: exists or roll my own? #15035
Unanswered
WilliamDEdwards
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Wish someone with technical knowledge of the etcd locks would comment. It has been our experience that use of the locks are problematic in most practical applications. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Case:
The solution seems obvious:
On receiving a watch event, all watchers try to acquire a named lock.
But is it safe to try acquiring a lock multiple times in a very short time span, or at exactly the same time?
If not, each client could sleep for
$random
seconds. If client A acquires the lock on second .1, and clients B and C try to acquire the lock .1 seconds later, the lock should be exclusive and acquired in order.Does etcd ship some high-level construct that combines multiple watchers + distributed lock? Or should I roll my own solution with these primitives?
Beta Was this translation helpful? Give feedback.
All reactions