Merge #1111 deploy re-send residuals: a re-send retries a Failed apply (newest-answered, no held ack); re-sends carry DeadlineRemaining so a late-reached node caps its address-space wait; coordinator keeps a node's Applied over a late stale Failed; in-memory acks + late-Failed-seal residual documented
This commit is contained in:
+48
-4
@@ -837,16 +837,60 @@ dial was dropped — either way the deployment sat until the 120 s deadline and
|
||||
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.
|
||||
- **…except a lost `Failed` ack, which is RETRIED (#1111).** A failed apply leaves the node on its last-good
|
||||
configuration, and the failure and the lost ack usually share a cause (a central blip during the fetch), so on a
|
||||
re-send of a deployment whose remembered ack is `Failed` the node re-attempts the apply instead of replaying
|
||||
`Failed`. Once per re-send, never concurrently (a copy arriving mid-retry is dropped as in-flight), and only while
|
||||
that deployment is still the node's **latest** answer with no other apply's ack held — a stale re-send of an older
|
||||
failed deployment after a newer one was applied replays `Failed` rather than rolling the node back. `Applied` and
|
||||
`Applied`+degraded acks keep the replay, so #601's "no repeated re-apply of a degraded revision on re-sends" holds.
|
||||
- **Central: Applied wins over a late Failed (#1111 review).** Because the node re-applies only after its own `Failed`,
|
||||
two acks from one node for one deployment can now differ — and the ORIGINAL `Failed` can still arrive after the
|
||||
retry's `Applied` (`GrpcApplyAckSender` walks the central endpoints, and a call that timed out may still have
|
||||
landed). Within one deployment `ConfigPublishCoordinator` therefore never lets a `Failed` overwrite that node's
|
||||
`Applied` (clean or degraded) once the Applied has **arrived** — counted, being persisted, parked behind a write, or
|
||||
held for a persist retry. The late `Failed` is discarded before its row write (logged at Info), so neither the count
|
||||
nor the node's `NodeDeploymentState` row flips back. The reverse is unchanged: an `Applied` arriving after a counted
|
||||
`Failed` still replaces it, as long as the deployment is open.
|
||||
- **Residual: a late `Failed` that CLOSES the deployment first.** If the stale `Failed` reaches central before the
|
||||
retry's `Applied` and it completes the expected set (a one-node cluster, or the peer already acked), the deployment is
|
||||
marked `PartiallyFailed` at once and the retry's `Applied` is then discarded as a stale ack ("Discarding stale ApplyAck").
|
||||
The node runs the new revision, but central's `Deployment` row reads `PartiallyFailed` and that node's
|
||||
`NodeDeploymentState` row reads `Failed` (on a fused `Direct` node the node's own row write races central's, so it may
|
||||
read either). Deliberately NOT corrected after the fact: re-opening a terminal deployment would break
|
||||
"a terminal outcome is written once" (review L8), sealing it late would give an older deployment a newer
|
||||
`SealedAtUtc` than one dispatched since — and "latest sealed" drives drift detection and the publish fallback — and
|
||||
the coordinator keeps no per-deployment state past closure to judge it with. It needs a re-send to reach the node
|
||||
after its `Failed` was delivered-but-unacknowledged, so it is narrow; it heals on the next deploy (a dispatch of the
|
||||
same revision short-circuits to `Applied` on a node whose address space is confirmed, and re-applies otherwise).
|
||||
- **A re-send carries what is left of the deadline (#1111).** `DispatchDeployment.DeadlineRemaining` (proto
|
||||
`optional int64 deadline_remaining_ms = 5`, additive) is set on every re-send — a RELATIVE duration, so central's
|
||||
and the node's clocks need not agree — and left unset on the original. A node whose apply was started by such a
|
||||
re-send bounds its held Applied ack's address-space wait to `DeadlineRemaining − 15 s` measured from **receipt**
|
||||
(so the artifact read and reconcile count against it; floor 1 s), instead of the full 105 s. A node first reached
|
||||
by the +35 s re-send (~85 s left) therefore releases an "outcome not reported in time" ack at ~70 s and the
|
||||
deployment seals "Applied (degraded)" rather than `TimedOut`. Wire compatibility: an old central never sets the
|
||||
field (absent ⇒ the node's full default wait, today's behaviour); an old node ignores it (gRPC unknown field / DPS
|
||||
JSON extra member) and keeps its 105 s wait — the pre-#1111 limit below applies to it. Residual: a re-send for a
|
||||
*different* deployment that arrives while the node is still applying another is stashed, and its wait is measured
|
||||
from when it is unstashed, not received — that only happens when the node is applying a deployment central has
|
||||
already superseded.
|
||||
- **Residuals.** A pre-#1107 node ignores `TargetNodes` and has none of the node-side idempotence, so during a
|
||||
rolling upgrade with central upgraded first it treats every re-send that reaches it as an original dispatch. On
|
||||
**DPS** that includes re-sends meant for its peer. On **either** transport it includes the common case of its
|
||||
OWN re-send while its Applied ack is still held on the address-space outcome (any apply slower than 5 s): the
|
||||
old node re-applies the same revision (the pre-#1107 `_pendingAcks` revision check forces it) and supersedes
|
||||
the held ack. The second apply's diff is empty, so this is redundant work rather than an outage, but
|
||||
**upgrade the driver nodes before central** to avoid it. 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.
|
||||
**upgrade the driver nodes before central** to avoid it.
|
||||
- **Remembered acks are in memory only — deliberately not persisted (#1111).** The last 16 acks live in the
|
||||
`DriverHostActor` instance. A node that restarted (process restart, or a supervision restart of the actor) after
|
||||
acking has forgotten them and treats a re-send as a first dispatch: it short-circuits `Applied` if it is already
|
||||
on that revision with a confirmed address space, and otherwise applies it (a re-apply if its revision is
|
||||
unconfirmed/degraded — the one case a restart can turn a degraded replay into a re-apply). The boot-time replay
|
||||
of an orphan `Applying` row is unaffected.
|
||||
- **Pre-#1111 node: late-re-send deadline limit.** A node that does not read `DeadlineRemaining` and first receives
|
||||
the dispatch at +35 s has ~85 s to ack but waits up to 105 s for its address-space outcome, so a rebuild slower
|
||||
than ~85 s seals `TimedOut` at central instead of "Applied (degraded)". Upgraded nodes bound the wait (above).
|
||||
|
||||
### What an `Applied` ack means: the degraded-apply amendment (Gitea #601)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user