diff --git a/seaweed-block/core/storage/walstore_fixed_work_test.go b/seaweed-block/core/storage/walstore_fixed_work_test.go index 9d56f07671..615a2efe3a 100644 --- a/seaweed-block/core/storage/walstore_fixed_work_test.go +++ b/seaweed-block/core/storage/walstore_fixed_work_test.go @@ -61,6 +61,8 @@ type phase173FixedWorkResult struct { WALAppendOps uint64 `json:"wal_append_ops"` WALWriteAtCalls uint64 `json:"wal_writeat_calls"` WALWriteAtBytes uint64 `json:"wal_writeat_bytes"` + WALWraps uint64 `json:"wal_wraps"` + WALPaddingBytes uint64 `json:"wal_padding_bytes"` WALAppendNanos uint64 `json:"wal_append_ns"` WALAppendLockWaitNanos uint64 `json:"wal_append_lock_wait_ns"` CommitLockWaitOps uint64 `json:"commit_lock_wait_ops"` @@ -275,8 +277,10 @@ func runPhase173FixedWork(t *testing.T, cfg phase173FixedWorkConfig, runID, stor if appendOps < uint64(cfg.APIOperations) { return phase173FixedWorkResult{}, fmt.Errorf("phase173 WAL append ops=%d want at least API operations=%d", appendOps, cfg.APIOperations) } - if writeAtCalls := writeAfter.WALAppendWriteAtCalls - writeBefore.WALAppendWriteAtCalls; writeAtCalls != appendOps { - return phase173FixedWorkResult{}, fmt.Errorf("phase173 WAL writeat calls=%d want append ops=%d", writeAtCalls, appendOps) + writeAtCalls := writeAfter.WALAppendWriteAtCalls - writeBefore.WALAppendWriteAtCalls + wraps := writeAfter.WALAppendWrapCount - writeBefore.WALAppendWrapCount + if writeAtCalls < appendOps || writeAtCalls-appendOps > wraps { + return phase173FixedWorkResult{}, fmt.Errorf("phase173 WAL writeat calls=%d append ops=%d wraps=%d", writeAtCalls, appendOps, wraps) } if got := writeAfter.WriteCommitLockWaitOps - writeBefore.WriteCommitLockWaitOps; got != uint64(cfg.APIOperations) { return phase173FixedWorkResult{}, fmt.Errorf("phase173 commit lock ops=%d want API operations=%d", got, cfg.APIOperations) @@ -329,6 +333,8 @@ func runPhase173FixedWork(t *testing.T, cfg phase173FixedWorkConfig, runID, stor WALAppendOps: writeAfter.WALAppendOps - writeBefore.WALAppendOps, WALWriteAtCalls: writeAfter.WALAppendWriteAtCalls - writeBefore.WALAppendWriteAtCalls, WALWriteAtBytes: writeAfter.WALAppendWriteAtBytes - writeBefore.WALAppendWriteAtBytes, + WALWraps: wraps, + WALPaddingBytes: writeAfter.WALAppendPaddingBytes - writeBefore.WALAppendPaddingBytes, WALAppendNanos: writeAfter.WALAppendDurationNanos - writeBefore.WALAppendDurationNanos, WALAppendLockWaitNanos: writeAfter.WALAppendLockWaitNanos - writeBefore.WALAppendLockWaitNanos, CommitLockWaitOps: writeAfter.WriteCommitLockWaitOps - writeBefore.WriteCommitLockWaitOps, diff --git a/seaweed-block/internal/docs/qa-assignments/phase173-d1-fixed-work-baseline-qa.md b/seaweed-block/internal/docs/qa-assignments/phase173-d1-fixed-work-baseline-qa.md index 45356c83ca..d10af3d563 100644 --- a/seaweed-block/internal/docs/qa-assignments/phase173-d1-fixed-work-baseline-qa.md +++ b/seaweed-block/internal/docs/qa-assignments/phase173-d1-fixed-work-baseline-qa.md @@ -45,7 +45,9 @@ Each JSON result must show one final sync, `dirty_entries=0`, and equal checkpoint/head/synced frontiers. WAL encode operations must equal logical blocks, commit-lock operations must equal fixed API operations, and physical WAL append calls must reconcile independently with `WriteAt` calls. A batch -may encode 16 records while coalescing them into one physical append. +may encode 16 records while coalescing them into one physical append. A WAL +wrap may add one separately counted padding `WriteAt`; `wal_wraps` and +`wal_padding_bytes` make that physical I/O explicit. ## Verdict diff --git a/seaweed-block/scripts/run-phase173-fixed-work-baseline-gate.sh b/seaweed-block/scripts/run-phase173-fixed-work-baseline-gate.sh index f42c1b8ac6..0fc8fdaf22 100755 --- a/seaweed-block/scripts/run-phase173-fixed-work-baseline-gate.sh +++ b/seaweed-block/scripts/run-phase173-fixed-work-baseline-gate.sh @@ -125,8 +125,11 @@ for row in rows: raise SystemExit(f"logical/WAL record mismatch: {row}") if row["commit_lock_wait_ops"] != row["api_operations"]: raise SystemExit(f"API/commit operation mismatch: {row}") - if row["wal_append_ops"] < row["api_operations"] or row["wal_writeat_calls"] != row["wal_append_ops"]: + if row["wal_append_ops"] < row["api_operations"]: raise SystemExit(f"API/WAL physical append mismatch: {row}") + extra_writeats = row["wal_writeat_calls"] - row["wal_append_ops"] + if extra_writeats < 0 or extra_writeats > row["wal_wraps"]: + raise SystemExit(f"WAL padding/writeat mismatch: {row}") if row["validation_failures"] != 0 or row["correctness_samples"] < 3: raise SystemExit(f"correctness evidence failed: {row}") if row["flusher_interval_ms"] != 100: