fix(deploy): #1107 re-send the deploy dispatch to nodes that have not acked

ConfigPublishCoordinator dispatched a deployment exactly once: on DPS a node whose
deployments registry entry had not gossiped to central missed it (#1106), on gRPC a
failed dial was dropped, and either way the deployment timed out at 120 s.

Coordinator: re-sends the same DispatchDeployment at +5/+15/+35 s (bounded by half the
remaining deadline) with the new additive TargetNodes naming only expected nodes whose
ack has not arrived (an ack still being persisted counts). Stops on last ack,
completion, time-out, supersede or schedule end; a recovered in-flight deployment gets
the same re-send. Counter otopcua.deploy.redispatched.

Transport: CentralCommunicationActor's gRPC fan dials only the named nodes; proto gains
repeated target_nodes = 4 (additive). On DPS, non-addressed nodes ignore the re-send.

Node (DriverHostActor): a re-send is idempotent per DeploymentId — ignored if not
addressed here or mid-apply; ANY copy of a deployment whose Applied ack is held on the
address-space outcome no longer starts a second apply; a re-send of a deployment it
already acked re-delivers the remembered ack (last 16) instead of re-applying (#601
would otherwise re-apply a degraded revision). Original dispatches are unchanged.

Docs: Redundancy.md §Dispatch re-send, Configuration.md, cluster-topology rule.
This commit is contained in:
Joseph Doherty
2026-12-04 22:29:17 -05:00
parent da23fd970d
commit 323bbd2a63
14 changed files with 860 additions and 23 deletions
+32 -3
View File
@@ -809,10 +809,39 @@ Two properties are load-bearing and easy to break:
- **Inbound commands go to the node-local `EventStream`, never back onto a DPS topic.** DPS is
mesh-wide and central fans out to *every* node, so a DPS re-publish would deliver N copies of
every command to every subscriber.
- **Both transports are fire-and-forget, with no retry or queue.** A failed gRPC dispatch is logged
(naming the node and the gRPC status) and dropped in the dispatch second — the deploy path's
- **Both transports are fire-and-forget at the transport layer, with no retry or queue.** A failed gRPC
dispatch is logged (naming the node and the gRPC status) and dropped in the dispatch second. Driver-control
and alarm commands stay that way. **Deployments are re-sent by the deploy coordinator** (below); the
2-minute apply deadline and a node's boot-time replay (`DriverHostActor.Bootstrap()` re-applying an
orphan `Applying` row) are the only recovery mechanisms, unchanged from the DPS/`ClusterClient` era.
orphan `Applying` row) remain the backstops.
### Dispatch re-send (Gitea #1107)
Until #1107 `ConfigPublishCoordinator` dispatched a deployment exactly once. On DPS a node whose
`deployments` registry entry had not yet gossiped to the publisher missed it (#1106); on gRPC a failed
dial was dropped — either way the deployment sat until the 120 s deadline and sealed `TimedOut`. Now:
- **Re-sent, bounded, to un-acked nodes only.** At +5 s, +15 s and +35 s
(`ConfigPublishCoordinator.DefaultRedispatchSchedule`, and never past half of the remaining deadline) the
coordinator re-sends the SAME `DispatchDeployment` (same `DeploymentId`/`RevisionHash`/`CorrelationId`)
with `TargetNodes` naming the expected nodes whose ack has not **arrived** — an ack still being persisted
counts as arrived. Re-sends stop at the last ack, completion, time-out, supersede, or the end of the
schedule; a recovered in-flight deployment (singleton fail-over) gets the same re-send inside what is left
of its deadline. Counter: `otopcua.deploy.redispatched` (per targeted node).
- **Why only un-acked nodes:** under #601 a same-revision dispatch makes a node whose last apply was
degraded *re-apply*. On gRPC central dials only the named nodes; on DPS the publish reaches every node and
`DispatchDeployment.IsAddressedTo` makes the others ignore it.
- **A re-send is idempotent on the node, per `DeploymentId`.** Mid-apply it is dropped (the existing
in-flight dedup); while the Applied ack is held on the address-space outcome, ANY copy of that deployment
is ignored (no second apply); once the node has acked, a re-send re-delivers the remembered ack (the last
16 deployments) instead of applying again — so a lost ack is recovered and a duplicate ack is harmless
(the coordinator re-persists the same outcome, or discards it as stale). An ORIGINAL dispatch is unchanged:
re-dispatching a degraded revision still re-applies.
- **Residuals.** A pre-#1107 node on the **DPS** transport ignores `TargetNodes`, so during a rolling upgrade
it can re-apply on a re-send meant for its peer (gRPC is unaffected — central filters). The node's memory
is process-local: a node that restarted after acking treats a re-send as a first dispatch (short-circuit,
or a re-apply if its revision is unconfirmed). A node that first receives the dispatch at +35 s still has
~85 s to ack; only a rebuild slower than that, which already acks degraded at 105 s, can miss the deadline.
### What an `Applied` ack means: the degraded-apply amendment (Gitea #601)