Files
seaweedfs/seaweed-block/core/schema
wzcheng99andClaude Opus 4.7 dec084485b P14 S1: proactive R>=H fence with ack-gated healthy publication
Adds an explicit FenceAtEpoch command + FenceCompleted/FenceFailed
event pair on the caught-up recovery branch. A replica with R >= H
under a newer identity epoch is no longer declared healthy until the
replica's lineage gate has been bumped to match Identity.Epoch via a
FenceCompleted — closing the window where stale old-epoch traffic
could still land on the replica while the projection already reads
healthy.

Contract surface:
  * Caught-up path emits ONLY FenceAtEpoch — no catch-up / no rebuild.
    Fence is a command+event pair, not a session lifecycle.
  * PublishHealthy held until FenceCompleted advances FencedEpoch.
    Publication and DeriveProjection both gate on this so the
    operator-visible mode reflects the ack-gated contract, not
    just the command stream.
  * FenceFailed is fail-closed: FencedEpoch is NOT advanced; retry
    is probe-driven (next successful probe re-runs decide() and
    re-emits FenceAtEpoch).
  * Session completion (catch-up / rebuild) implicitly fences,
    because mutating traffic at the current epoch already bumped
    the replica's gate.
  * Stale FenceCompleted (epoch < Identity.Epoch, or same epoch
    with older endpointVersion) is rejected without mutating state.
  * FencedEpoch is engine-internal; NOT exposed in ReplicaProjection.

Adapter-side fence dispatch:
  * fenceInFlight keyed by fence LINEAGE
    (replicaID, epoch, endpointVersion), NOT by replicaID alone.
    This prevents a newer-epoch fence from being starved by an
    older in-flight fence — both occupy distinct slots, the old
    one is dropped by the engine as stale when its callback lands,
    and the newer one drives publication to healthy without
    waiting for an unrelated later probe.

Proof tests:
  * engine: TestFence_CaughtUpPath_UsesNoDataRecovery
  * engine: TestFence_HealthyOnlyAfterFenceComplete
  * engine: TestFence_FailureLeavesFencedEpochUnchanged
  * engine: TestFence_StaleOldEpochRejectedAfterFenceOnCaughtUp
  * adapter: TestFullRoute_CaughtUp_NotHealthyUntilFenceComplete
  * adapter: TestFence_NewerEpochNotStarvedByOlderInFlightFence

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 16:29:23 -07:00
..