mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
test(master): fixtures record the first ready answer where the primary served; the restart gap is still creating
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e520aa762
commit
b201bbb74d
5 files changed
+18
-3
No files matched your search
@@ -50,8 +50,9 @@ func TestPrimaryAwaitingReplicaStoresIsNotReplacedForNotReady(t *testing.T) {
|
||||
// The real-path schedule: the master has recorded every store (its wait is
|
||||
// over) but the primary has not received the re-sent assignment yet, so it
|
||||
// still answers "awaiting replica stores"; the master restarts in that gap.
|
||||
// The excuse is the primary's own answer, so nothing the master forgets on a
|
||||
// restart reopens the gap: the line stays.
|
||||
// Creation ends only at the primary's first ready answer, recorded durably,
|
||||
// so the restarted master still holds the volume: no decision, the line
|
||||
// stays.
|
||||
func TestMasterRestartInTheGapDoesNotReassign(t *testing.T) {
|
||||
cfg := Config{AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(),
|
||||
ControllerConfig: authority.TopologyControllerConfig{PrimaryBootGrace: 200 * time.Millisecond}}
|
||||
@@ -74,7 +75,7 @@ func TestMasterRestartInTheGapDoesNotReassign(t *testing.T) {
|
||||
t.Fatal("fixture: the restarted master still waits for stores")
|
||||
}
|
||||
time.Sleep(250 * time.Millisecond) // past the boot grace
|
||||
unsupportedTick(t, h2, readySlot("r1-a"))
|
||||
creatingTick(t, h2, readySlot("r1-a"))
|
||||
expectLineStaysR1(t, h2, "restarted master, primary still awaiting the re-sent stores")
|
||||
}
|
||||
|
||||
|
||||
@@ -239,3 +239,14 @@ func TestCreationEndsAtThePrimarysFirstReadyAnswer(t *testing.T) {
|
||||
t.Fatalf("creation reopened after it ended (%s)", why)
|
||||
}
|
||||
}
|
||||
|
||||
// recordFirstReady records that the volume's primary answered ready at its
|
||||
// first line (after its stores were attested): fixtures whose primary was
|
||||
// healthy before the scenario's failure.
|
||||
func recordFirstReady(t *testing.T, h *Host, volumeID string) {
|
||||
t.Helper()
|
||||
h.attest.awaited(volumeID, h.replicaSlotsFor(volumeID))
|
||||
if err := h.attest.noteFirstReady(volumeID); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -460,6 +460,7 @@ func TestMountedFailover_ProductLoopRF3PromotesWhenCurrentProbeIsDownDespiteStal
|
||||
t.Fatalf("initial line=%+v want r1", initial)
|
||||
}
|
||||
attestAllStores(t, h) // an established volume, out of its creation wait
|
||||
recordFirstReady(t, h, "vol-rf3")
|
||||
|
||||
// Heartbeat state still says r1 is acceptable. The on-demand
|
||||
// current-primary probe is the fresher failure signal and must
|
||||
|
||||
@@ -77,6 +77,7 @@ func TestPromotionRefusesReplicaMissingAcknowledgedWrite(t *testing.T) {
|
||||
if err := h.ingestStoreAttestation("node-a", attestation("vol-rf3", "r1", initial.Epoch, attested)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
recordFirstReady(t, h, "vol-rf3") // the primary served before it failed
|
||||
if err := cluster.Primary().RepVol.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ func TestPromotionRefusesAReplacedStoreThePrimaryNeverAttested(t *testing.T) {
|
||||
if err := h.ingestStoreAttestation("node-a", attestation("vol-rf3", "r1", line.Epoch, map[string]storage.StoreID{"r1": storeID(1), "r2": s1, "r3": t1})); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
recordFirstReady(t, h, "vol-rf3") // the primary served before it failed
|
||||
// r2's node reports its new store: never the reference.
|
||||
if err := h.ingestStoreAttestation("node-b", attestation("vol-rf3", "r2", line.Epoch, map[string]storage.StoreID{"r2": s2})); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in new issue
Block a user