mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
seaweed-block: a rack outage test repeats retryable answers after recovery
After the outage, the snapshot resume and the plain detach are repeated every 5 s for at most 5 min while they answer retryable, as a client does; the first and the last answers are recorded. The guest write after the detach's answer is recorded, not asserted: serving resumes once the holder settles the stop as aborted, so a completed write there is the settled outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b4b13fdf2e
commit
8024a15577
1 file changed
+40
-10
@@ -72,6 +72,7 @@ const (
|
||||
e9Window = 90 * time.Second
|
||||
e9IOBound = 20 * time.Second // one guest command's answer bound
|
||||
e9AnswerBound = 8 * time.Minute // a cut or detach must answer within this
|
||||
e9RepeatBound = 5 * time.Minute // a client repeats a retryable answer for this long after the outage
|
||||
)
|
||||
|
||||
func TestE9RackOutageOnAReleasedStore(t *testing.T) {
|
||||
@@ -233,12 +234,12 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) {
|
||||
case detach.status != http.StatusServiceUnavailable || detach.code != "cut_stalled" || !detach.retryable || !strings.Contains(detach.message, "I/O stays stopped"):
|
||||
t.Errorf("step 7: the plain detach answered HTTP %d %q retryable %v %q; want 503 cut_stalled, retryable, \"I/O stays stopped\"", detach.status, detach.code, detach.retryable, detach.message)
|
||||
}
|
||||
// Guest I/O stays stopped: one write after the detach does not complete.
|
||||
// Guest I/O after the detach's answer: recorded, not asserted. I/O stays
|
||||
// stopped only while the stop is unsettled; once the holder settles it as
|
||||
// aborted (a stop-abort HEAD write, nothing published) serving resumes, so
|
||||
// a write that completes here is the settled outcome, not a violation.
|
||||
probeWrite := e9WriteProbe(env, 10*time.Second)
|
||||
t.Logf("E9-OUTAGE step 7 guest write after the detach: %s", probeWrite)
|
||||
if probeWrite == "completed" {
|
||||
t.Errorf("step 7: a guest write completed after the plain detach answered %q", detach.code)
|
||||
}
|
||||
|
||||
// 8. HEAD's committed image is the baseline's and the pre-outage
|
||||
// snapshot names the same root; orphans recorded.
|
||||
@@ -265,21 +266,50 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) {
|
||||
|
||||
// 11 (before 10: a detached volume admits no snapshot, a resumed one
|
||||
// included). The stalled snapshot resumed with its request id succeeds.
|
||||
// A client repeats a retryable answer: every 5 s for at most 5 min.
|
||||
snaps11 := snapList()
|
||||
resumed := e9CLI(t, env, snapCLIArgs...)
|
||||
start11 := time.Now()
|
||||
var resumed e9CLIAnswer
|
||||
var first11 string
|
||||
tries11 := 0
|
||||
for {
|
||||
tries11++
|
||||
resumed = e9CLI(t, env, snapCLIArgs...)
|
||||
if tries11 == 1 {
|
||||
first11 = fmt.Sprintf("exit %d code=%q: %s", resumed.exit, resumed.code, firstLine(resumed.message))
|
||||
}
|
||||
if resumed.exit == 0 || !resumed.retryable || time.Since(start11) > e9RepeatBound {
|
||||
break
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
listed := e9SnapshotListed(t, env, outageSnap)
|
||||
t.Logf("E9-OUTAGE step 11 snapshot resumed with its request id: exit %d code=%q after %s: %s; %s listed=%v; snapshots before=%s after=%s",
|
||||
resumed.exit, resumed.code, resumed.at.Round(time.Millisecond), firstLine(resumed.message), outageSnap, listed, snaps11, snapList())
|
||||
t.Logf("E9-OUTAGE step 11 snapshot resumed with its request id: %d tries over %s, first %s; last exit %d code=%q: %s; %s listed=%v; snapshots before=%s after=%s",
|
||||
tries11, time.Since(start11).Round(time.Millisecond), first11, resumed.exit, resumed.code, firstLine(resumed.message), outageSnap, listed, snaps11, snapList())
|
||||
if resumed.exit != 0 || !listed {
|
||||
t.Errorf("step 11: the resumed snapshot answered exit %d code %q, listed %v; want success and %s listed", resumed.exit, resumed.code, listed, outageSnap)
|
||||
}
|
||||
|
||||
// 10. The same plain detach, repeated, completes.
|
||||
snaps10 := snapList()
|
||||
detached := e9Handle(t, status, "/chunk/detach", map[string]any{"volumeID": "v1", "plain": true, "timeoutMs": e9Window.Milliseconds()})
|
||||
start10 := time.Now()
|
||||
var detached e9Answer
|
||||
var first10 string
|
||||
tries10 := 0
|
||||
for {
|
||||
tries10++
|
||||
detached = e9Handle(t, status, "/chunk/detach", map[string]any{"volumeID": "v1", "plain": true, "timeoutMs": e9Window.Milliseconds()})
|
||||
if tries10 == 1 {
|
||||
first10 = fmt.Sprintf("HTTP %d code=%q", detached.status, detached.code)
|
||||
}
|
||||
if detached.status == http.StatusOK || !detached.retryable || time.Since(start10) > e9RepeatBound {
|
||||
break
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
h10 := head()
|
||||
t.Logf("E9-OUTAGE step 10 plain detach repeated: HTTP %d code=%q retryable=%v after %s: %s; HEAD gen=%d epoch=%d position=%d state=%q image=%s; snapshots before=%s after=%s",
|
||||
detached.status, detached.code, detached.retryable, detached.at.Round(time.Millisecond), firstLine(detached.message),
|
||||
t.Logf("E9-OUTAGE step 10 plain detach repeated: %d tries over %s, first %s; last HTTP %d code=%q retryable=%v after %s: %s; HEAD gen=%d epoch=%d position=%d state=%q image=%s; snapshots before=%s after=%s",
|
||||
tries10, time.Since(start10).Round(time.Millisecond), first10, detached.status, detached.code, detached.retryable, detached.at.Round(time.Millisecond), firstLine(detached.message),
|
||||
h10.Gen, h10.Epoch, h10.Position, h10.State, image(h10), snaps10, snapList())
|
||||
if detached.status != http.StatusOK {
|
||||
t.Errorf("step 10: the repeated plain detach answered HTTP %d %q retryable %v; want 200", detached.status, detached.code, detached.retryable)
|
||||
|
||||
Reference in new issue
Block a user