writeonce/runtime/test
shoney.arickathil aa89fb6c97 feat(db): the checkpoint trigger, and compaction is wired to BOTH write paths — T3
databasev2 3, task 3.

- wo_wal_should_compact is a PURE decision (used bytes, last compaction's
  measured output, floor, ratio) so it is testable without a store —
  which is the only way a policy like this gets tested at all. Denominator
  is the last compaction's real output, not an estimate of the live set:
  estimating would mean estimating Text
- 8 boundary assertions incl. "exactly 3x is not MORE than 3x" and a zero
  ratio disabling the policy rather than dividing by nothing
- MUTATION-TESTED instead of observing RED: implementation and test were
  written together, so removing the floor check was verified to fail
  exactly the two floor assertions. Equivalent evidence, stated plainly
- WO_CHECKPOINT_BYTES / WO_CHECKPOINT_RATIO at boot beside WO_MAILBOX.
  The knobs are what make the policy testable — a gate sets a tiny floor
  and forces compaction in a few writes instead of megabytes
- NO timer, per the spec: Postgres' CheckPointTimeout bounds loss from
  unflushed buffers; our records are durable at commit and an idle log
  does not grow
- the ordering rule is now asserted, not trusted: a test stages a record,
  requests compaction, and requires REFUSAL with the log untouched and
  the staged record still committable afterwards

FOUND AND FIXED a gap in my own wiring. The plan said to call the check
"after the drain's barrier", and I did — but a statement running ON the
owner shard never enters that drain, so WO_SHARDS=1 never compacted and
its log grew forever: measured 536086 bytes where the multi-shard run
held 446024. Now checked after the inline path's commit too (db.c
maybe_compact), where the buffer is equally empty. WO_SHARDS=1 went
536086 -> 260657 bytes. For a checkpoint this mattered more than part A's
equivalent gap: an unbounded log is an operational failure, not just lost
throughput.

Also corrected a measurement of my own: multi-shard logs looked unbounded
(448KB -> 1013KB -> 1647KB across 8k/24k/48k updates). They are not.
Instrumentation showed compaction ran 25 times with zero failures, each
writing MORE than the last, because the live set genuinely grows — wmix's
hist_dump and done-markers are themselves durable inserts. Final log
1631040 against a last compaction of 866432 is a ratio of 1.88, just under
the 2x threshold: the policy holding exactly.

Replies are released BEFORE compaction runs, deliberately: their records
are already durable, and holding them across a stop-the-world rewrite
would add its full duration to their latency for nothing.

Verified: wovm-test 36 suites 0 fail, test_wal 360 pass; db-bench-quick
crash.s1/crash.sN and both restart legs green, and part A still batches
(sN mean 4.16, peak 30).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 18:43:44 +02:00
..
.gitkeep feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
cli_smoke.sh feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
mkwob.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
t.h feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_arena.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_borrow.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_builtin.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_cont.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_crypto.c feat: iteration 34 — digest builtins sha1/sha256/hmac_sha256 (ids 85-87) 2026-08-23 00:42:43 +02:00
test_cycle.c feat(runtime): incremental tri-color mark-sweep replaces RC (7b Phase 3a) 2026-08-19 16:52:48 +02:00
test_fiber.c feat(runtime): fiber run queue + reduction budget (arc T2) 2026-08-20 07:03:40 +02:00
test_icall.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_loader.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_mailbox.c feat: bounded mailboxes + WO_T_ACTOR (trap 13); try-arm place-copy fix 2026-08-23 01:05:13 +02:00
test_obj.c feat(runtime): incremental tri-color mark-sweep replaces RC (7b Phase 3a) 2026-08-19 16:52:48 +02:00
test_objops.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_rc.c feat(runtime): incremental tri-color mark-sweep replaces RC (7b Phase 3a) 2026-08-19 16:52:48 +02:00
test_table.c feat: O(1) read path — index probe wired end to end 2026-08-22 16:44:56 +02:00
test_unwind.c feat: retire RC from the emitter and the format — .wob v4 (7b Phase 3b) 2026-08-19 17:07:43 +02:00
test_vm.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_wal.c feat(db): the checkpoint trigger, and compaction is wired to BOTH write paths — T3 2026-08-28 18:43:44 +02:00
test_wobbuild.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
wob_build.c feat: secondary indexes + @unique trap (iteration 9, Task 4; wob v3) 2026-08-15 12:57:32 +02:00
wob_build.h feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00