mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
f6ae66254fe2c225f352d215f71d3dc1b095bba7
uint32 assertions, host-level tests, matrix honesty)
QA round-21 spot-check flagged four issues in the T4a-6 landing.
All four confirmed correct; this commit addresses them as one
reviewable unit per QA's recommended batch.
Finding #1 (HIGH) — install-or-refuse ordering in Host.streamOnce.
Previous order was OnAssignment → UpdateReplicaSet, creating a
window where the adapter's projection flipped Healthy before the
peer set was installed. StorageBackend.lineageCheck would then
pass and admit local-only writes with zero fan-out. V2 atomically
set replicas before admitting writes; V3 had drifted. Fix:
- Extract applyFact(fact) from streamOnce's inner loop so the
handler logic is testable in isolation.
- Invert order: if h.replication != nil, call UpdateReplicaSet
FIRST. On failure, LOG and RETURN without calling OnAssignment.
Adapter projection stays at its prior (not-Healthy until a
fact fully installs) state; StorageBackend keeps writes
blocked; master's stream replay redelivers the fact and
natural convergence resumes on the next cycle.
- Introduce narrow collaborator interfaces (assignmentConsumer,
replicaSetUpdater) on Host so test doubles can drive applyFact
without spinning up a real adapter + transport listener. The
concrete adapter reference is retained as realAdpt for the
existing Adapter() accessor.
Finding #2 (MEDIUM) — generation aliasing at the uint32 boundary.
`(epoch << 32) | uint32(ev)` silently aliased distinct authority
lines whenever either field exceeded 2^32. Fix:
- Extract generationFitsUint32(epoch, ev) as a named package-
level function with a descriptive reason string.
- SubscribeAssignments calls generationFitsUint32 before minting
the fact; on rejection, logs a structured diagnostic + skips
the fact (master keeps running — this is a fail-fast on an
invariant violation upstream, not a master-side error).
- Pin with two adversarial tests: TestGenerationFitsUint32_
MaxValidAccepted (epoch = 2^32-1, ev = 2^32-1 passes) and
_OverflowRejected (epoch = 2^32 and ev = 2^32 each reject
with reasons naming the offending field).
Finding #3 (MEDIUM) — T4a-5 host wire was uncovered by T4a-6. The
L2 integration test bypassed Host.streamOnce entirely, so the
"all T4a commits compose correctly" claim in commit 420a5a1 was
stronger than what the test proved. Fix:
- New apply_fact_test.go in core/host/volume with five pins:
* TestHost_ApplyFact_Self_InstallsReplicaSetBeforeAssignment
(ordering recorder proves UpdateReplicaSet before
OnAssignment in the happy path).
* TestHost_ApplyFact_Self_UpdateReplicaSetFailure_SkipsOnAssignment
(fail-closed pin for finding #1).
* TestHost_ApplyFact_Supersede_NeverCallsAdapterOrReplication
(the supersede branch is unaffected by the reordering).
* TestHost_ApplyFact_ObserverOnly_NoReplicationCallsOnAssignment
(nil replication seam still flows to OnAssignment as before).
* TestDecodeReplicaTargets_FieldCopy (auxiliary; catches
decoder drift).
- The commit message and batch-close story now honestly reflect
that host ordering is covered. Full master → gRPC → host
subprocess L2 integration deferred to T4b/T4c where the
durability/recovery path makes it materially more valuable
(per QA round-21 guidance).
Finding #4 (LOW) — matrix 'non-gating' fiction removed.
The earlier runMatrix harness had walstore_nongating that
claimed to demote subtest failures. Go's testing has no clean
demote-subtest-failure API; the defer-based logic didn't
actually demote. Replaced with honest naming: walstore is a
second gating row (passes today under T4a best-effort paths;
if it ever regresses under BUG-007 the test fails honestly
and we invest in a real demotion harness then). File header
comment updated to match.
Verification: full 21-package repo suite green including
core/host (122s integration run) and the 5 new host tests. No
regressions.
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%