mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
docs(recovery): mirror Tier-1 §IV.2.1 / FS-1 / Gate G0 anchors
Annotation-only pass on the three Tier-1 completion-authority sites
in core/recovery, mirroring the architect's pass on the seaweedfs
weed/storage/blockvol + weed/server side. No logic change — every
predicate remains exactly as before; only doc comments added that
point future migrators at:
sw-block/design/recover-semantics-adjustment-plan.md §1 (the migration plan)
sw-block/design/learn/2026-05-01-recover-target-audit.md Tier 1 (the audit)
v3-recovery-algorithm-consensus.md §IV.2.1 (the new PrimaryWalLegOk contract)
consensus §I P8 (recover(a) vs recover(a,b) distinction)
Sites annotated:
core/recovery/rebuild_session.go:192
TryComplete predicate `walApplied < targetLSN` — historic
recover(a,b) gate; migration target = baseDone ∧
ReplicaWalWitness ∧ coordinator-explicit PrimaryWalLegOk OR
barrier state machine phase.
core/recovery/peer_ship_coordinator.go:273
CanEmitSessionComplete `achievedLSN >= targetLSN` — historic
recover(a,b) gate; migration target = PrimaryWalLegOk(P) under
serializer lock + ReplicaWalWitness reporting at the
BarrierHandshake cut.
core/recovery/sender.go:480-484
Run's CanEmitSessionComplete check + FailureContract on
achieved<target — historic recover(a,b) Run-success predicate;
migration target = baseDone (replica) ∧ PrimaryWalLegOk(P)
(primary WalShipper) ∧ BarrierHandshake; FailureContract
rebound to "lifecycle contract violation" rather than "did
not reach Y".
Build + tests clean (recovery + transport). Tier-1 behavior edits
remain blocked on Gate G0 (T2 predicate name + witness channel
pinning) per recover-semantics-adjustment-plan.md §0.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
25a1be2872
commit
39cfe1ce84
3 files changed
+34
No files matched your search
@@ -263,6 +263,17 @@ func (c *PeerShipCoordinator) TryAdvanceToSteadyLive(id ReplicaID) bool {
|
||||
//
|
||||
// CHK-BARRIER-BEFORE-CLOSE: callers MUST have observed a successful
|
||||
// barrier round-trip before calling this; it is purely the comparison.
|
||||
//
|
||||
// §IV.2.1 / FS-1 / Gate G0 — Tier 1 completion-authority site.
|
||||
// The `achievedLSN >= st.targetLSN` predicate below is the historic
|
||||
// recover(a,b) gate; per consensus §I P8, this is NOT the recover(a)
|
||||
// completion authority. Migration target (per
|
||||
// `sw-block/design/recover-semantics-adjustment-plan.md` §1 +
|
||||
// `learn/2026-05-01-recover-target-audit.md` Tier 1) replaces this
|
||||
// with PrimaryWalLegOk(P) under serializer lock + ReplicaWalWitness
|
||||
// reporting at the BarrierHandshake cut. AchievedLSN becomes a
|
||||
// per-cut witness, not a "crossed target" finishing condition. NO
|
||||
// behavior change pre-Gate G0.
|
||||
func (c *PeerShipCoordinator) CanEmitSessionComplete(id ReplicaID, achievedLSN uint64) bool {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
@@ -180,6 +180,18 @@ func (s *RebuildSession) MarkBaseComplete() {
|
||||
// INV-SESSION-COMPLETE-ON-CONJUNCTION-LAYER1. Note: the system-level
|
||||
// "rebuild done" closure additionally requires a barrier-ack from the
|
||||
// replica matching achievedLSN — that is layer 2's responsibility.
|
||||
//
|
||||
// §IV.2.1 / FS-1 / Gate G0 — Tier 1 completion-authority site.
|
||||
// The `walApplied < targetLSN` predicate below is the historic
|
||||
// recover(a,b) gate; per consensus §I P8, this is NOT the recover(a)
|
||||
// completion authority. The migration target (per
|
||||
// `sw-block/design/recover-semantics-adjustment-plan.md` §1 row
|
||||
// "TryComplete: walApplied ≥ Target 独断 → 新 conjunct" and
|
||||
// `learn/2026-05-01-recover-target-audit.md` Tier 1 row) replaces
|
||||
// this with `baseDone ∧ ReplicaWalWitness ∧ (coordinator-explicit
|
||||
// PrimaryWalLegOk OR barrier state machine phase)`. NO behavior
|
||||
// change pre-Gate G0; Tier-1 edits await T2 predicate name + witness
|
||||
// channel pinning.
|
||||
func (s *RebuildSession) TryComplete() (achievedLSN uint64, done bool) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
@@ -477,6 +477,17 @@ func (s *Sender) Run(ctx context.Context, sessionID, fromLSN, targetLSN uint64)
|
||||
case <-ctx.Done():
|
||||
return 0, newFailure(FailureCancelled, PhaseBarrierResp, ctx.Err())
|
||||
}
|
||||
// §IV.2.1 / FS-1 / Gate G0 — Tier 1 completion-authority site.
|
||||
// The CanEmitSessionComplete check below + FailureContract on
|
||||
// `achieved < target` is the historic recover(a,b) Run-success
|
||||
// predicate; per consensus §I P8, this is NOT the recover(a)
|
||||
// completion authority. Migration target (per
|
||||
// `sw-block/design/recover-semantics-adjustment-plan.md` §1 +
|
||||
// `learn/2026-05-01-recover-target-audit.md` Tier 1) replaces
|
||||
// this with `baseDone (replica) ∧ PrimaryWalLegOk(P) (primary
|
||||
// WalShipper) ∧ BarrierHandshake`; FailureContract is rebound
|
||||
// to "barrier-pre violation / lifecycle contract violation"
|
||||
// rather than "did not reach Y". NO behavior change pre-Gate G0.
|
||||
if !s.coordinator.CanEmitSessionComplete(s.replicaID, achieved) {
|
||||
return achieved, newFailure(FailureContract, PhaseBarrierResp,
|
||||
fmt.Errorf("achieved=%d < target=%d", achieved, targetLSN))
|
||||
|
||||
Reference in new issue
Block a user