mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
wip: failover tests see the lagging replica; it holding the highest end makes the volume wait
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c39a9213ac
commit
8f6b79a022
1 file changed
+13
-4
@@ -59,10 +59,12 @@ func ingestRF3Incarnations(t *testing.T, h *Host, r1, r2, r3 rf3Slot) {
|
||||
}
|
||||
}
|
||||
|
||||
// switchProbe is the promotion probe: r2 is always a ready survivor;
|
||||
// switchProbe is the promotion probe: r2 is always a ready survivor, r3
|
||||
// answers as a lagging replica (not ready; its end is r3End, 60 when unset);
|
||||
// the current primary r1 is ready only while currentReady is set.
|
||||
type switchProbe struct {
|
||||
mu sync.Mutex
|
||||
r3End uint64
|
||||
currentReady bool
|
||||
// currentUnknown: the current primary did not answer (status GET
|
||||
// refused or timed out), so CurrentKnown is false.
|
||||
@@ -99,15 +101,22 @@ func (p *switchProbe) ProbePromotionCandidates(volumeID string, current authorit
|
||||
defer p.mu.Unlock()
|
||||
return PromotionProbeResult{
|
||||
AckProfile: "sync-quorum",
|
||||
// Only r2 is seen, so its promotion needs a known frontier
|
||||
// it covers (#181); r3 is silent in these tests.
|
||||
// Only r2 is ready, so its promotion needs a known frontier it
|
||||
// covers (#181); r3 answers but lags. A fencing round counts both.
|
||||
SyncAckLSN: 70,
|
||||
CurrentKnown: !p.currentUnknown,
|
||||
Current: PromotionCandidateEvidence{ReplicaID: "r1", Ready: p.currentReady, DurableLSN: 70},
|
||||
Candidates: []PromotionCandidateEvidence{{ReplicaID: "r2", Ready: true, DurableLSN: 70}},
|
||||
Candidates: []PromotionCandidateEvidence{{ReplicaID: "r2", Ready: true, DurableLSN: 70}, {ReplicaID: "r3", DurableLSN: p.lagEnd()}},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *switchProbe) lagEnd() uint64 {
|
||||
if p.r3End == 0 {
|
||||
return 60
|
||||
}
|
||||
return p.r3End
|
||||
}
|
||||
|
||||
func probeOf(t *testing.T, h *Host) *switchProbe {
|
||||
t.Helper()
|
||||
h.promotionMu.RLock()
|
||||
|
||||
Reference in new issue
Block a user