Files
seaweedfs/seaweed-block/core/host
2a7cee5dda seaweed-block: a fenced replace always reaches a publication (#13435)
* fix(master): a promotion gate's replace decision logs what the controller did with it

A replace decided by the promotion gate went to the topology controller,
which can drop it on six paths without a word. These are: a stale basis,
superseded slot facts, a boot-grace hold, no evidence on the target, an
ask that is already desired, and an unsupported topology. When a volume
then did not fail over, nothing on the master's log said why.

The controller now records, per volume, what its last intake did: the ask
it enqueued, or why it enqueued none (LastOutcome). After each tick's
submit, the master logs every replace decision with that outcome, or with
why the decisions were not submitted. Every publication is logged too.

The creation-gap process test derives its failover bound from its own
flags: one loop to the tick that ends creation, plus the freshness window
to the loss, plus one loop to the tick that reads it. It waits twice that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: a replace decision is reported with its own submission's outcome, and on a binding-read failure

Review round 1:
- The tick reads the controller's outcome for each volume inside the
  intake that carried it (SubmitObservedStateOutcomes, under the
  controller's lock): the background observation host shares the
  controller and may submit before a later read.
- A workspace binding read that fails after the probe reports the tick's
  replace decisions as not submitted, with the error, before returning.
- The production-tick test waits for the publication line (bounded): the
  publisher logs it from its observer after the line is visible.
- A replace decision is identified by a flag set where it is decided, not
  by its display text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: red: a gate replace the controller keeps, and a lost Reassign held for ever

Two reds for the master's fenced replace that never publishes.

A primary only the gate rejects (its node reads an older format level,
its own flags still read reachable and ready, no loss recorded) is
replaced by a fencing round on every tick, and the controller answers
"no ask: the current primary is acceptable" on every tick.

A Reassign the publisher took and ended without publishing is lost, and
the same-ask dedupe answers "already desired" on every later intake, so
nothing enqueues it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: a fenced replace always reaches the controller as a failover, and a lost Reassign is enqueued again

The gate marks the replaced primary's slot unacceptable in what it submits
on every fenced replace, not only when a loss is recorded. A primary only
the gate rejects (a node below the cluster's format level) was kept by the
controller's own acceptability predicate on every tick.

The same-ask dedupe holds a desired ask only while it is pending: queued,
or taken by the publisher and still being applied (the queue records the
ask the publisher holds until it asks for the next one). An identical ask
that is neither ended without a publication and is enqueued again, keeping
its DesiredAt so a repeatedly lost ask still reports Stuck.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: ledger row for the replace-decision report

Review round 2: Part C rule 4. INV-PROMOTE-DECISION-REPORTED-001 names the
regression tests this change adds (an intake after the submission, the
binding-read failure after the probe) and their enforcing functions.
Diagnostics only: no state machine or model change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the desired-ask retry keeps its DesiredAt to Stuck; contract rows

Review round 2 (both P2s):
- TestARepeatedlyLostReassignKeepsItsDesiredAtAndBecomesStuck runs four
  take -> ended-without-publication -> re-enqueue cycles across the retry
  window: DesiredAt stays the first desire and the Stuck evidence names it.
  A retry that re-anchors DesiredAt fails it.
- docs/design/invariants.md: M2 gains the controller-ask machine between
  the promotion gate and the publisher (queued, held, lost, re-enqueued,
  Stuck; the fenced-replace handoff), with its diagram, and the rows
  INV-AUTH-DESIRED-RETRY-001 and INV-PROMOTE-REPLACE-HANDOFF-001 naming the
  regression tests. No published specification models this handoff; the
  rows say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: red: an ask published during the intake is enqueued again

The publisher can publish the desired ask and come back for its next one
between the line read an intake decides against and that intake's same-ask
dedupe. The queue then holds nothing for the volume, so the dedupe reads
the ask as lost and enqueues it again; a planned move carries no fence, so
the publisher would mint it a second time at a new epoch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: split the replace-decision ledger row under the statement limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: a desired ask published during the intake is not enqueued again

The lost-ask retry read "not pending" as "ended without a publication",
but the publisher also stops holding an ask once it has published it and
asked for the next one. When that happens between the line read the intake
decided against and the dedupe, re-read the line: the ask is lost only
while the line is still the one it was decided against.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: gateNoteMu also guards gateReplaces

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: split the controller-ask contract rows to one property each

INV-AUTH-DESIRED-RETRY-001 (346 characters) and
INV-PROMOTE-REPLACE-HANDOFF-001 (459) were over the 300-character
statement limit TestInvariantStatementsAreShort enforces. Each becomes two
rows; the lost-ask row also names the published-during-intake regression
and its line re-read guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the controller-ask rows cite the promotion liveness model r6

The model now splits the intake as the code does (read the line and decide;
enqueue only if the ask is not pending and the line is unchanged). It
holds RoundProgress and QueuedMatchesLine and catches the mutants
dedupe_keeps_lost, predicate_split and nonatomic_submit. The four rows and
the M2 controller-ask section name them; the retry window and Stuck are not
modelled, and the rows say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: mark the PromoLive r6 citations as checked outside the repository (on #13435) (#13442)

seaweed-block: mark the PromoLive r6 citations as checked outside the repository

The convention says a TLA+ entry names a specification in docs/spec/,
and PromoLive r6 is not there.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: red: a queued Reassign overwrites a later publication

A controller Reassign waits in the queue until the publisher takes it. A
failback published outside the queue in that window is overwritten by
the ask decided against the older line, both for a first ask and for a
lost one enqueued again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: a controller Reassign names the line it was decided against

The rebalance and failover asks carry ExpectCurrent, as the controller's
endpoint refresh already does, so the publisher refuses one whose line
moved while it waited in the queue. A refused ask ends without a
publication and the next intake decides again against the new line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: a Reassign is refused when its expected line moved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the Reassigned row states what the expected-line check compares

Review: expectedLineMoved compares replica, epoch and addresses, so a
same-address endpoint reissue (new endpoint version or incarnation)
still matches and a queued move decided before it publishes; the
move's epoch bump fences the reissued line. The row now says so instead
of claiming every later publication.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the queued-rebalance known issue is fixed in v1.1.2

blockmaster's rebalance and failover now name the line they were decided
against and are refused when it moved: the v1.1.1 known issue and the
replicated preview's item 6 say it is fixed in v1.1.2, and the v1.1.2
notes list the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the expected-line check compares addresses only when the ask names them

Review: expectedLineMoved treats an empty expected address as a wildcard,
and an operator's failback names replica and epoch only, so an endpoint
move to other addresses does not refuse a failback. The Reassigned row
now says the address comparison applies only to asks that name them (the
controller's moves).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the v1.1.2 fix covers moves decided before the failover

Review: a rebalance decided after an operator's failover names the new
line and can still move the primary; the fixed-in note now covers only
a move decided before the failover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-12-05 19:25:12 -08:00
..