mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
4a38e5cbcef9dc2268249e4e6d97a48cb6805ff9
First production batch for the G5-5C primary-side degraded-peer probe loop, per the architect-bound mini-plan v0.5 §1.A binding (Option B, core/replication/ ownership) and §1.H audit-PASS verdict at seaweedfs@9245446b5. Files: - core/replication/probe_loop.go (new): ProbeLoop struct with config + start/stop lifecycle (sync.Once on both); per-iteration tick that snapshots peers via PeerSourceFn, gates each via CooldownFn, dispatches via ProbeFn; CP4B-2 lessons applied (zero-interval rejected at construction; stop-before-start no deadlock; callback panic isolated via recover). - core/replication/probe_loop_test.go (new): seven lifecycle tests covering Start/Stop happy path, stop-before-start, idempotent concurrent stop, zero-interval rejection, callback panic isolation, cooldownFn gating, empty peer set, and probeFn-error-doesn't-stop. Design: - ProbeLoop is runtime/wiring only. No engine FSM, no transport. - Seams (PeerSourceFn / ProbeFn / CooldownFn) injected by host so the loop knows nothing about adapter, executor, or engine. - Default config: Interval 5s, MaxConcurrent 1, CooldownBase 5s, CooldownCap 60s — architect-bound G5-5C v0.5 §1.A shape. - Authority-bound (§1.E): peersFn snapshots ReplicationVolume.peers under lock; loop never enumerates network-discoverable addresses. - All G5-5C INVs map cleanly to existing engine/replication state per the §1.H audit; this skeleton adds NO recovery substrate. Tests verified: - go test ./core/replication/ -run TestProbeLoop -count=1: PASS (7/7) - go test ./core/replication/ -count=1: PASS (no regression on existing T4a-5/T4b/T4c suites) Next batch (G5-5C #2): peer.go::ProbeIfDegraded() + cooldown state-machine + in-flight guard tests.
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%