diff --git a/seaweed-block/core/frontend/durable/provider_chunk_noflush_test.go b/seaweed-block/core/frontend/durable/provider_chunk_noflush_test.go index f4dec3dd68..e03fca3605 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk_noflush_test.go +++ b/seaweed-block/core/frontend/durable/provider_chunk_noflush_test.go @@ -125,14 +125,30 @@ func runNoClientFlushBurst(t *testing.T, mode storage.WMode) { target := ws.NextLSN() - 1 cpObserved := cpAtBusy // Getters only: no Write, Sync, NotifyUrgent or Close may - // drive progress before the first retry. - for cpAtBusy < target && cpObserved <= cpAtBusy && time.Since(passiveStart) < 10*time.Second { + // drive progress before the first retry. The 10 s window + // counts from the last moment a flusher cycle was in + // progress: a cycle slower than the window (a slow disk on a + // loaded host) is waited for, up to the write's retry + // deadline. A completed cycle that did not advance the + // checkpoint does not extend it, so a flusher that cycles + // without reclaiming still fails within the window. + const passiveWindow = 10 * time.Second + lastInCycle := passiveStart + flushing := func() bool { + fi := ws.FlusherInstrumentation() + return fi.CyclesStarted > fi.CyclesSucceeded+fi.CyclesFailed + } + for cpAtBusy < target && cpObserved <= cpAtBusy && time.Since(lastInCycle) < passiveWindow && time.Now().Before(retryDeadline) { time.Sleep(25 * time.Millisecond) cpObserved = ws.CheckpointLSN() + if flushing() { + lastInCycle = time.Now() + } } - t.Logf("NO FLUSH passive bytes=%d wait=%v cpBefore=%d cpAtBusy=%d cpObserved=%d target=%d", off, time.Since(passiveStart), cpBefore, cpAtBusy, cpObserved, target) - if time.Since(passiveStart) >= 10*time.Second || (cpAtBusy < target && cpObserved <= cpAtBusy) { - t.Fatalf("NO FLUSH passive checkpoint did not advance without another write: bytes=%d cp=%d busy=%d", off, cpObserved, busyCount) + fi := ws.FlusherInstrumentation() + t.Logf("NO FLUSH passive bytes=%d wait=%v cpBefore=%d cpAtBusy=%d cpObserved=%d target=%d flusher: cycles started=%d succeeded=%d failed=%d max=%v, last in a cycle %v ago", off, time.Since(passiveStart), cpBefore, cpAtBusy, cpObserved, target, fi.CyclesStarted, fi.CyclesSucceeded, fi.CyclesFailed, time.Duration(fi.CycleMaxDurationNanos), time.Since(lastInCycle)) + if cpAtBusy < target && cpObserved <= cpAtBusy { + t.Fatalf("NO FLUSH passive checkpoint did not advance without another write: bytes=%d cp=%d busy=%d (flusher in a cycle %v ago, cycles started=%d succeeded=%d failed=%d)", off, cpObserved, busyCount, time.Since(lastInCycle), fi.CyclesStarted, fi.CyclesSucceeded, fi.CyclesFailed) } } // Retry the identical command; no caller Flush drives reclamation.