Update node external_id in ZK on retries

We currently only update the external_id record in ZK at the start
and end of a statemachine lifecycle.  That means we can miss getting
a new external_id during a retry.

To fix this, update the external_id any time it changes as long as
the state machine does have an external_id (ie, we will not clear
it from ZK).

Change-Id: Ie4c5df89fd6afd0f8c7e3fdd1bccd2e499444aef
This commit is contained in:
James E. Blair 2024-09-24 15:43:18 -07:00
parent a0d1eb5022
commit d29a014699

View File

@ -291,7 +291,8 @@ class StateMachineNodeLauncher(stats.StatsReporter):
if state_machine.state != old_state:
self.log.debug("State machine for %s advanced from %s to %s",
node.id, old_state, state_machine.state)
if not node.external_id and state_machine.external_id:
if (state_machine.external_id and
node.external_id != state_machine.external_id):
node.external_id = state_machine.external_id
self.zk.storeNode(node)
if state_machine.complete and not self.nodescan_request: