Double check node allocation in a few more places
Since we operate a lot on cached data we need to make sure that the state of the node did not check after we've locked it. This change mainly focuses on checking the `allocated_to` field where necessary. Change-Id: I7eb51464f5de88a973ee39e25b57ec9ff2d851da
This commit is contained in:
parent
adf44ecdf0
commit
0a858c4be8
|
@ -589,6 +589,11 @@ class CleanupWorker(BaseCleanupWorker):
|
|||
"request", node.id)
|
||||
return
|
||||
|
||||
# Make sure the state didn't change on us
|
||||
if node.allocated_to != req.id:
|
||||
zk_conn.unlockNode(node)
|
||||
continue
|
||||
|
||||
# If the node is in state init then the launcher that worked
|
||||
# on the lost request has been interrupted between creating
|
||||
# the znode and locking/setting to building. In this case the
|
||||
|
|
|
@ -2650,7 +2650,7 @@ class ZooKeeper(ZooKeeperBase):
|
|||
continue
|
||||
|
||||
# Make sure the state didn't change on us
|
||||
if node.state != READY:
|
||||
if node.state != READY or node.allocated_to:
|
||||
self.unlockNode(node)
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in New Issue