Fix node state checks after aquiring lock
Node states are never refreshed from Zookeeper before checking if the state changed between looping and aquiring the lock. Change-Id: I259c74cfd5ceb590b124b692e645656a0b85be25
This commit is contained in:
parent
ef6be899b6
commit
2c2376b844
@ -553,8 +553,10 @@ class CleanupWorker(BaseCleanupWorker):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Double check the state now that we have a lock since it
|
# Double check the state now that we have a lock since it
|
||||||
# may have changed on us.
|
# may have changed on us. We keep using the original node
|
||||||
if node.state != zk.READY:
|
# since it's holding the lock.
|
||||||
|
_node = zk_conn.getNode(node.id)
|
||||||
|
if _node.state != zk.READY:
|
||||||
zk_conn.unlockNode(node)
|
zk_conn.unlockNode(node)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -605,8 +607,10 @@ class CleanupWorker(BaseCleanupWorker):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Double check the state now that we have a lock since it
|
# Double check the state now that we have a lock since it
|
||||||
# may have changed on us.
|
# may have changed on us. We keep using the original node
|
||||||
if node.state != zk.HOLD:
|
# since it's holding the lock.
|
||||||
|
_node = zk_conn.getNode(node.id)
|
||||||
|
if _node.state != zk.HOLD:
|
||||||
zk_conn.unlockNode(node)
|
zk_conn.unlockNode(node)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -716,8 +720,10 @@ class DeletedNodeWorker(BaseCleanupWorker):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Double check the state now that we have a lock since it
|
# Double check the state now that we have a lock since it
|
||||||
# may have changed on us.
|
# may have changed on us. We keep using the original node
|
||||||
if node.state not in cleanup_states:
|
# since it's holding the lock.
|
||||||
|
_node = zk_conn.getNode(node.id)
|
||||||
|
if _node.state not in cleanup_states:
|
||||||
zk_conn.unlockNode(node)
|
zk_conn.unlockNode(node)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user