From e360536dc6a3c297c6d3f64878cb5bf3f576d642 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 29 Jul 2026 21:38:36 -0700 Subject: [PATCH] phase168: count admitted native WAL requests --- .../core/storage/parallelwal/native_submitter.go | 7 +++++++ .../parallelwal/native_submitter_linux_amd64_test.go | 8 +++++--- seaweed-block/core/storage/parallelwal/store.go | 6 ++++++ .../scripts/run-phase168-native-wal-owner-gate.sh | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/seaweed-block/core/storage/parallelwal/native_submitter.go b/seaweed-block/core/storage/parallelwal/native_submitter.go index 18062e7567..d44ae018db 100644 --- a/seaweed-block/core/storage/parallelwal/native_submitter.go +++ b/seaweed-block/core/storage/parallelwal/native_submitter.go @@ -12,6 +12,7 @@ import ( type NativeIOStats struct { Enabled bool QueueDepth uint32 + AdmittedRequests uint64 SubmissionRounds uint64 SQEs uint64 SubmitSyscalls uint64 @@ -99,6 +100,12 @@ func (submitter *nativeWALSubmitter) recordQueueFull() { submitter.mu.Unlock() } +func (submitter *nativeWALSubmitter) recordAdmitted(count int) { + submitter.mu.Lock() + submitter.stats.AdmittedRequests += uint64(count) + submitter.mu.Unlock() +} + func (s *Store) NativeIOStats() NativeIOStats { if s.native == nil { return NativeIOStats{} diff --git a/seaweed-block/core/storage/parallelwal/native_submitter_linux_amd64_test.go b/seaweed-block/core/storage/parallelwal/native_submitter_linux_amd64_test.go index 92e289ff41..21ed661e1b 100644 --- a/seaweed-block/core/storage/parallelwal/native_submitter_linux_amd64_test.go +++ b/seaweed-block/core/storage/parallelwal/native_submitter_linux_amd64_test.go @@ -30,14 +30,16 @@ func TestIOUringOwnerBatchesAcrossLanesAndRecoversPortably(t *testing.T) { t.Fatalf("LSNs=%v want=[1 2 3 4]", lsns) } stats := store.NativeIOStats() - if !stats.Enabled || stats.SubmissionRounds != 1 || stats.SQEs != 4 || + if !stats.Enabled || stats.AdmittedRequests != 4 || + stats.SubmissionRounds != 1 || stats.SQEs != 4 || stats.CompletionCount != 4 || stats.InflightHighWater != 4 || stats.FallbackCount != 0 { t.Fatalf("native stats=%+v", stats) } t.Logf( - "native_owner_stats enabled=%t rounds=%d sqes=%d completions=%d inflight_high_water=%d fallback=%d", + "native_owner_stats enabled=%t admitted=%d rounds=%d sqes=%d completions=%d inflight_high_water=%d fallback=%d", stats.Enabled, + stats.AdmittedRequests, stats.SubmissionRounds, stats.SQEs, stats.CompletionCount, @@ -91,7 +93,7 @@ func TestIOUringOwnerRotatesAcrossLanesAtDepthOne(t *testing.T) { t.Fatal(err) } stats := store.NativeIOStats() - if stats.QueueDepth != 1 || stats.SubmissionRounds != 4 || + if stats.QueueDepth != 1 || stats.AdmittedRequests != 4 || stats.SubmissionRounds != 4 || stats.SQEs != 4 || stats.CompletionCount != 4 { t.Fatalf("depth-one native stats=%+v", stats) } diff --git a/seaweed-block/core/storage/parallelwal/store.go b/seaweed-block/core/storage/parallelwal/store.go index 7948fee23f..11a235d785 100644 --- a/seaweed-block/core/storage/parallelwal/store.go +++ b/seaweed-block/core/storage/parallelwal/store.go @@ -620,6 +620,9 @@ func (s *Store) submit(lba uint32, data []byte, sourceLSN uint64) (uint64, error s.nextLSN = lsn + 1 s.pending[lsn] = req s.inflightAppends++ + if s.native != nil { + s.native.recordAdmitted(1) + } startDrainer := s.queueRequest(l, req) s.mu.Unlock() if startDrainer { @@ -718,6 +721,9 @@ func (s *Store) WriteBatch(startLBA uint32, blocks [][]byte) ([]uint64, error) { } s.nextLSN += uint64(len(reqs)) s.inflightAppends += len(reqs) + if s.native != nil { + s.native.recordAdmitted(len(reqs)) + } startDrainers := make([]bool, len(s.lanes)) for _, req := range reqs { if s.queueRequest(s.lanes[req.lane], req) { diff --git a/seaweed-block/scripts/run-phase168-native-wal-owner-gate.sh b/seaweed-block/scripts/run-phase168-native-wal-owner-gate.sh index 1c3e895381..3d26426921 100755 --- a/seaweed-block/scripts/run-phase168-native-wal-owner-gate.sh +++ b/seaweed-block/scripts/run-phase168-native-wal-owner-gate.sh @@ -38,8 +38,9 @@ timeout 60s go test ./core/storage/parallelwal \ -count=1 -v >"${OWNER_LOG}" 2>&1 require_line '^--- PASS: TestIOUringOwnerBatchesAcrossLanesAndRecoversPortably ' "${OWNER_LOG}" require_line '^--- PASS: TestPositionedExecutionRemainsDefault ' "${OWNER_LOG}" -require_line 'native_owner_stats enabled=true rounds=1 sqes=4 completions=4 inflight_high_water=4 fallback=0' "${OWNER_LOG}" +require_line 'native_owner_stats enabled=true admitted=4 rounds=1 sqes=4 completions=4 inflight_high_water=4 fallback=0' "${OWNER_LOG}" write_summary "single_owner_cross_lane_round=pass" +write_summary "admitted_requests=4" write_summary "submission_rounds=1" write_summary "sqes=4" write_summary "completions=4"