qa: account for WAL wrap padding writes

This commit is contained in:
pingqiu committed 2026-07-31 23:49:55 -07:00
1 parent 1f9bee2b4d
commit 1ea8dacd95
3 files changed
+15 -4

No files matched your search

@@ -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,
@@ -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
@@ -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: