mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
bb390a9a974e2be4d320a415362a313e22a8d275
Closes the T4b batch with end-to-end matrix coverage of all three
DurabilityMode semantics + a wire-shape scope-leak fence. Each
scenario drives the full StorageBackend.Sync → observer.Sync →
DurabilityCoordinator → peer.Barrier → real ReplicaListener path
on real TCP between in-process pairs.
Mirrors T4a-6 harness shape (matrix runner, primaryRig +
replicaRig pattern, LIFO cleanup discipline). Both backends
(smartwal + walstore) are gating in the L2 harness — round-22
honesty correction inherited.
Scenarios (4 × 2 backends = 8 matrix rows):
TestT4b6_SyncAll_TwoPeers_AllHealthy
sync_all happy path. 20 LBAs through StorageBackend.Write +
Observe + ship to both replicas; Sync delegates to observer
which runs local fsync + 2 peer barriers in parallel via
DurabilityCoordinator. Sync returns nil; both peers stay
Healthy; replica byte-exact via primary.store vs r1/r2.store
(forward-carry: T4a-6 BasicEndToEnd byte-exact invariant
continues to hold).
TestT4b6_SyncAll_OnePeer_FailsOnBarrierError
sync_all rejects ANY peer failure. 1 healthy + 1 unreachable
peer; Sync returns ErrDurabilityBarrierFailed. Dead peer is
Degraded (peer.Barrier translation,
INV-REPL-BARRIER-FAILURE-DEGRADES-PEER). Healthy peer's
state stays Healthy — its individual barrier succeeded; the
failure is mode-driven, not transport-driven.
TestT4b6_SyncQuorum_RF3_TolerantOfOneFailure
sync_quorum tolerates 1/2 peer failure when quorum is 2.
Primary(1) + healthy peer(1) = 2 durable >= 2 quorum → Sync
nil. Sanity sub-case: with BOTH peers dead, sync_quorum
returns ErrDurabilityQuorumLost (1/3 durable < 2/3 quorum).
Pins V2 dist_group_commit.go quorum arithmetic end-to-end
through the V3 wire.
TestT4b6_BestEffort_AllPeersFail_StillSucceeds
best_effort silences all-peers-failed. 2 unreachable peers;
Sync returns nil. Both peers Degraded via peer.Barrier
Invalidate. Primary's local fsync ran (walHead reflects the
writes). Pins V2's "best_effort returns nil even on full
replication failure" semantic.
TestT4b6_BarrierWire_FullLineageEcho_StillEnforced
Wire-shape scope-leak fence (architect round-22 pattern).
Asserts EncodeBarrierResp output is exactly 40 bytes (32B
lineage + 8B AchievedLSN). Asserts round-trip preserves
every lineage field byte-exact. Asserts 39B truncation is
rejected at decode (T4b-1 fail-closed contract). Catches
any future refactor that silently weakens to epoch-only
or short form, independent of whether the matrix scenarios
above also fail.
Forward-carry verification (matrix run + standalone):
- All T4a-6 tests (BasicEndToEnd_PrimaryWriteReachesReplicaByteExact
+ BestEffort_DisconnectThenReassign) continue to pass.
- T4a-4 adversarial pin
(TestReplicationVolume_OnLocalWrite_ConcurrentLSNs_OrderedAtReplica)
continues to pass — INV-REPL-LSN-ORDER-FANOUT-001 not
regressed by Sync code path.
- T4b-3 wrapper tests + T4b-4 coordinator tests + T4b-5 Sync
tests all green.
Verification: full 21-package repo suite green. core/replication
test time 0.6s including all 8 matrix rows. G-2 tri-line godoc on
test helpers (setReplicaSet, writePrimaryBlocks, reservedDeadAddr).
G-3 cumulative.
Sixth and final task in T4b batch. T4b mechanically closed: 6/6
tasks landed, all gates green, all invariants pinned. Awaiting QA
single-sign per §8C.2 for batch close.
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%