Files
seaweedfs/seaweed-block/core/engine
Ping Qiu 1c453375cf recovery: PinUnderRetention bypasses retry budget (priority #3 [retry] Option A) (#15)
Architect-ratified Option A 2026-04-29: bug-fix shape for the
boundary mapping gap that let `recovery.FailurePinUnderRetention`
fall through to `engine.RecoveryFailureTransport` (retryable). Engine
re-emitted Start* on the same lineage, the same ack triggered the
same pin violation, and the lineage spun until the retry budget
exhausted — masking the "fresh probe + new lineage" signal the
typed envelope was meant to surface.

Pinned by INV-PIN-COMPATIBLE-WITH-RETENTION at the engine retry
gate. Option B kickoff (per-failure-kind budget + lossless recovery
↔ engine mapping + retry observability) tracked separately; Option
B prerequisites #3 [retry] backoff/wall-clock cap.

Engine kind (`core/engine/events.go`):
  + RecoveryFailurePinUnderRetention — typed enum value + String case.
    Documented non-retryable, distinct from WALRecycled (which auto-
    escalates to Rebuild). PinUnderRetention is mid-session contract
    violation; new lineage decision belongs to next probe.

Engine retry path (`core/engine/apply.go::applySessionFailed`):
  + Early-return branch mirroring StartTimeout pattern: trace +
    PublishDegraded; Attempts unchanged; Decision NOT auto-flipped
    (counter-WALRecycled — engine doesn't pre-decide rebuild vs
    catch-up at fresh fromLSN).

Boundary mapping (`core/transport/recovery_session.go::classifyRecoveryFailure`):
  + New `*recovery.Failure` errors.As branch. Option A scope:
    PinUnderRetention only. Other recovery kinds (Wire, Protocol,
    Substrate, Contract, Cancelled, SingleFlight, Unknown) deferred
    to Option B kickoff — fall-through fence test asserts they keep
    landing on Transport until B lands explicit cases.

Tests (5 new):
  Engine retry-bypass (3 in `recovery_pin_retention_test.go`):
    + TestT4d_PinUnderRetention_BypassesRetryBudget — headline:
      no Start* re-emit; Attempts unchanged; PublishDegraded emitted;
      Decision NOT auto-escalated.
    + TestT4d_PinUnderRetention_AtBudgetEdge_DoesNotEscalate —
      negative pin: even at wal_delta MaxRetries=3 edge, pin
      violation MUST NOT trigger round-47 catch-up-exhaustion-→-
      rebuild path (proves the bypass branch doesn't bump the
      counter).
    + TestRecoveryFailureKind_PinUnderRetention_String — diagnostic
      surface pin (logs / traces grep on this string).
  Boundary mapping (2 in `classifier_pin_under_retention_test.go`):
    + TestClassifier_RecoveryPinUnderRetention_MapsToEngineKind —
      headline mapping; counter-pin asserts NOT Transport fallback.
    + TestClassifier_RecoveryFailure_OtherKinds_StillFallThrough —
      Option B fence: enumerates every deferred recovery kind,
      asserts they fall through to Transport. Forces Option B to
      consciously update both the production switch and this test.

Verified: `go test ./core/engine/ ./core/transport/ ./core/recovery/
./core/storage/... ./core/replication/component/ -count=1` — all
green.

inv-test-map.md row INV-PIN-COMPATIBLE-WITH-RETENTION extended:
coord layer + engine retry-bypass + boundary mapping; status flips
to "pinned (coord + engine retry-bypass + boundary mapping)".

Branch hygiene: stacked off `g7-redo/recycle-pin-hookup` for context
linkage, but architect-tagged "可与 wiring 并行" — separate concurrent
PR. Depends on neither wiring nor recycle-pin-hookup at code level.
2026-04-29 16:23:57 -07:00
..