mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-27 15:30:45 +01:00
fix: tighten FC1 new-session assertion and FC4 proof-detail check
FC1: now asserts HasActiveSession() after address change AND verifies session_created in log (not just plan_cancelled). FC4: escalation event detail must be >15 chars (contains proof reason with LSN values, not just "needs_rebuild"). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
cd4b91033f
commit
cd8bfb21d4
1 file changed
+21
-1
@@ -94,15 +94,27 @@ func TestP2_FC1_ChangedAddress(t *testing.T) {
|
|||||||
t.Fatalf("FC1: endpoint not updated: %s", senderAfter.Endpoint().DataAddr)
|
t.Fatalf("FC1: endpoint not updated: %s", senderAfter.Endpoint().DataAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify new session was created after address change.
|
||||||
|
if !senderAfter.HasActiveSession() {
|
||||||
|
t.Fatal("FC1: new session must be created after address change")
|
||||||
|
}
|
||||||
|
|
||||||
hasCancelled := false
|
hasCancelled := false
|
||||||
|
hasNewSession := false
|
||||||
for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") {
|
for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") {
|
||||||
if e.Event == "plan_cancelled" {
|
if e.Event == "plan_cancelled" {
|
||||||
hasCancelled = true
|
hasCancelled = true
|
||||||
}
|
}
|
||||||
|
if e.Event == "session_created" {
|
||||||
|
hasNewSession = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if !hasCancelled {
|
if !hasCancelled {
|
||||||
t.Fatal("FC1: log must show plan_cancelled")
|
t.Fatal("FC1: log must show plan_cancelled")
|
||||||
}
|
}
|
||||||
|
if !hasNewSession {
|
||||||
|
t.Fatal("FC1: log must show session_created after address change")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- FC2: Stale epoch after failover (integrated engine/storage, control simulated) ---
|
// --- FC2: Stale epoch after failover (integrated engine/storage, control simulated) ---
|
||||||
@@ -231,13 +243,21 @@ func TestP2_FC4_UnrecoverableGap_Forced(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasEscalation := false
|
hasEscalation := false
|
||||||
|
hasProofDetail := false
|
||||||
for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") {
|
for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") {
|
||||||
if e.Event == "escalated" {
|
if e.Event == "escalated" {
|
||||||
hasEscalation = true
|
hasEscalation = true
|
||||||
|
// Detail must contain the proof reason with LSN values.
|
||||||
|
if len(e.Detail) > 15 {
|
||||||
|
hasProofDetail = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !hasEscalation {
|
if !hasEscalation {
|
||||||
t.Fatal("FC4: log must show escalation with gap details")
|
t.Fatal("FC4: log must show escalation event")
|
||||||
|
}
|
||||||
|
if !hasProofDetail {
|
||||||
|
t.Fatal("FC4: escalation event must contain proof reason with LSN details")
|
||||||
}
|
}
|
||||||
t.Logf("FC4: NeedsRebuild proven — replica=0, tail=%d, proof=%s",
|
t.Logf("FC4: NeedsRebuild proven — replica=0, tail=%d, proof=%s",
|
||||||
state.WALTailLSN, plan.Proof.Reason)
|
state.WALTailLSN, plan.Proof.Reason)
|
||||||
|
|||||||
Reference in new issue
Block a user