docker / libkv

Distributed key/value store abstraction library
Apache License 2.0
854 stars 205 forks source link

do not wait lock when network broken #181

Open 9sheng opened 6 years ago

9sheng commented 6 years ago

I use github.com/docker/leadership with etcd store. When there is only 1 candidate, if the networks break down(i.e. use iptables) and then recover, the candidate cannot get the lock.
The reason is that if the candidate is waiting for the lock when networks recover, the wait will never return. since no other candidate exists, the lock node will NEVER be changed.

GordonTheTurtle commented 6 years ago

Please sign your commits following these rules: https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work The easiest way to do this is to amend the last commit:

$ git clone -b "fix-etcd-lock" git@github.com:9sheng/libkv.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.