From 45a82b7bcee29985a96c305ae03ae3bb6c357c8b Mon Sep 17 00:00:00 2001 From: pingqiu Date: Thu, 19 Nov 2026 05:15:17 -0800 Subject: [PATCH] storage: the seed log test accepts stage times of a second and more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pattern required a unit prefix ("ms", "µs", "ns") before "s", so a stage that took a second or more ("1.453517616s", seen under load on a slow fsync) failed the test. It now matches a duration at any scale. Co-Authored-By: Claude Opus 5.5 --- .../storage/chunk_frontier_v3_log_test.go | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/seaweed-block/core/storage/chunk_frontier_v3_log_test.go b/seaweed-block/core/storage/chunk_frontier_v3_log_test.go index 3d74b0dffb..cda132ed20 100644 --- a/seaweed-block/core/storage/chunk_frontier_v3_log_test.go +++ b/seaweed-block/core/storage/chunk_frontier_v3_log_test.go @@ -43,7 +43,12 @@ func captureSeedLog(t *testing.T) *seedLog { return l } -var seedTimesLine = regexp.MustCompile(`storage: seed frontier 7: capture\+lifecycle lock wait [0-9.]+[a-zµ]+s, store mutex\+validation [0-9.]+[a-zµ]+s, data sync \(incl\. sync serialization\) [0-9.]+[a-zµ]+s, checkpoint publish [0-9.]+[a-zµ]+s, err=`) +// durationRE matches a time.Duration's String form at any scale: "92ns", +// "1.0197ms", "1.4535s", "2m3.5s". +const durationRE = `(?:[0-9.]+(?:ns|us|µs|ms|s|m|h))+` + +var seedTimesLine = regexp.MustCompile(`storage: seed frontier 7: capture\+lifecycle lock wait ` + durationRE + `, store mutex\+validation ` + durationRE + + `, data sync \(incl\. sync serialization\) ` + durationRE + `, checkpoint publish ` + durationRE + `, err=`) // A v3 seed logs its lock wait, data fsync and checkpoint publication // times once per seed that did I/O, with its outcome; a no-op repeat and a @@ -158,3 +163,18 @@ func TestWALStoreV3SeedLogsOutsideTheStoreLocks(t *testing.T) { t.Fatal("the seed did not finish after the log output was released") } } + +// The stage-time pattern accepts durations of a second and more (a slow +// fsync under load printed "1.453517616s" and failed the old pattern). +func TestSeedTimesLineMatchesEveryDurationScale(t *testing.T) { + for _, d := range []string{"92ns", "498ns", "1.019665ms", "1.453517616s", "2m3.5s", "1h0m0s"} { + line := "storage: seed frontier 7: capture+lifecycle lock wait " + d + ", store mutex+validation " + d + + ", data sync (incl. sync serialization) " + d + ", checkpoint publish " + d + ", err=" + if !seedTimesLine.MatchString(line) { + t.Errorf("pattern rejects %q", d) + } + } + if seedTimesLine.MatchString("storage: seed frontier 7: capture+lifecycle lock wait , store mutex+validation 1s, data sync (incl. sync serialization) 1s, checkpoint publish 1s, err=") { + t.Error("pattern accepts a missing duration") + } +}