mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
fix(test): align component cluster harness to replica-%d (Phase 0 prerequisite)
The component harness (cluster.go) constructed dual-lane executors with rid="r-%d" while the engine driver in dual_lane_engine_test.go sent AssignmentInfo / ProbeResult under "replica-%d". Pre-Phase-0- Fix-#1 this silently diverged: bridge keyed coord.PinFloor under "r-N", sink keyed WalShipper writeMu + post-emit RecordShipped under "replica-N". The rebuild barrier completed despite the keying mismatch (replica-driven BarrierResp), so the bug stayed invisible. Now that startRebuildDualLane fail-closes on a mismatched non-empty construction RID (commit11392ba), this drift surfaces as a hard error in TestDualLane_EngineDrivenRebuild_HappyPath / _WithPushLive DuringSession. Aligning the harness to the engine driver's "replica-%d" convention restores the invariant: construction RID == engine arg, coord/sink/bridge all keyed identically. Test assertions that probed the stale "r-0" key (lines 110, 197, 251 region) updated to "replica-0". Refs: INV-RID-UNIFIED-PER-SESSION (commit11392ba); v3-recovery-execution-institution.md Phase 0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
11392baf41
commit
eb4071ed05
2 files changed
+22
-4
No files matched your search
@@ -459,7 +459,17 @@ func (c *Cluster) Start() *Cluster {
|
||||
executors := make([]*transport.BlockExecutor, c.replicaN)
|
||||
for i, r := range c.replicas {
|
||||
if c.dualLane {
|
||||
rid := recovery.ReplicaID(fmt.Sprintf("r-%d", i))
|
||||
// INV-RID-UNIFIED-PER-SESSION: the construction RID MUST
|
||||
// match the engine driver's per-replica ID (the arg flowing
|
||||
// through StartRebuild). Engine driver convention here is
|
||||
// "replica-%d" — see the AssignmentInfo / ProbeResult
|
||||
// callsites in dual_lane_engine_test.go and the
|
||||
// VolumeReplicaAdapter's keying. Pre-Phase-0-Fix-#1 this
|
||||
// was "r-%d", which silently diverged: bridge keyed coord
|
||||
// under "r-N" while sink keyed under "replica-N". The
|
||||
// startRebuildDualLane assert now fails closed on that
|
||||
// mismatch.
|
||||
rid := recovery.ReplicaID(fmt.Sprintf("replica-%d", i))
|
||||
executors[i] = transport.NewBlockExecutorWithDualLane(
|
||||
pStore, r.Addr, r.DualLaneAddr, c.coord, rid,
|
||||
)
|
||||
|
||||
@@ -107,7 +107,11 @@ func TestDualLane_EngineDrivenRebuild_HappyPath(t *testing.T) {
|
||||
}
|
||||
|
||||
// Coordinator should be back to Idle for replica-0.
|
||||
if got := c.Coord().Phase(recovery.ReplicaID("r-0")); got != recovery.PhaseIdle {
|
||||
// Phase-0-Fix-#1 INV-RID-UNIFIED-PER-SESSION: the engine arg
|
||||
// flowing through StartRebuild is "replica-0"; the bridge now
|
||||
// keys coord under that arg. (Pre-fix this was "r-0",
|
||||
// matching the cluster harness's stale construction RID.)
|
||||
if got := c.Coord().Phase(recovery.ReplicaID("replica-0")); got != recovery.PhaseIdle {
|
||||
t.Errorf("coord phase post-session: %s want Idle", got)
|
||||
}
|
||||
|
||||
@@ -190,7 +194,8 @@ func TestDualLane_CoordReleasesPinFloorAfterSession(t *testing.T) {
|
||||
if _, anyActive := c.Coord().MinPinAcrossActiveSessions(); anyActive {
|
||||
t.Errorf("post-session: MinPinAcrossActiveSessions still reports anyActive=true")
|
||||
}
|
||||
if got := c.Coord().PinFloor(recovery.ReplicaID("r-0")); got != 0 {
|
||||
// Phase-0-Fix-#1: keyed under the engine arg "replica-0" (was "r-0").
|
||||
if got := c.Coord().PinFloor(recovery.ReplicaID("replica-0")); got != 0 {
|
||||
t.Errorf("post-session: PinFloor=%d want 0 (released)", got)
|
||||
}
|
||||
})
|
||||
@@ -246,7 +251,10 @@ func TestDualLane_EngineDrivenRebuild_WithPushLiveDuringSession(t *testing.T) {
|
||||
t.Fatal("BlockExecutor missing dual-lane PrimaryBridge")
|
||||
}
|
||||
|
||||
// PeerShipCoordinator keys match NewBlockExecutorWithDualLane replica id ("r-0").
|
||||
// PeerShipCoordinator keys match NewBlockExecutorWithDualLane replica id
|
||||
// ("replica-0" post-Phase-0-Fix-#1). DualLanePrimaryBridge() returns the
|
||||
// construction RID, which now agrees with the engine arg per
|
||||
// INV-RID-UNIFIED-PER-SESSION.
|
||||
if c.Coord().Phase(coordRID) == recovery.PhaseIdle {
|
||||
t.Fatal("coord still Idle after rebuild dispatch — PushLiveWrite would fail")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user