feat(scheduler-dispatch-commit): add durable WAL_JOB_DISPATCH fact type (task 1.2)

New wal_entry_type WAL_JOB_DISPATCH=12, reusing wal_jobstate_t verbatim
(_pad=0, absolute-value semantics), wired into both apply_wal_entry()'s
and apply_committed_entry()'s existing job-state fall-through groups per
Requirement 2.4. Restart-replay test writes only WAL_JOB_SUBMIT+
WAL_JOB_DISPATCH to a real on-disk WAL and confirms job.state==RUN after
a fresh persist_recover(), independent of WAL_JOB_START.

Review found apply_wal_entry() has zero production call sites today
(persist_recover() and standby catch-up both route through
apply_committed_entry() post the 2026-07-10 ha_apply_single_entry
refactor) -- design.md's stale characterization corrected; the dual
case-label registration itself is unaffected and correct.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-23 07:12:50 +00:00
parent 5724d1e90a
commit 8eea74909c
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
7 changed files with 367 additions and 5 deletions

View file

@ -114,6 +114,15 @@ typedef enum {
* the whole array (base spec + index range),
* distinct from WAL_JOB_SUBMIT's single-job
* format, which stays unchanged. */
WAL_JOB_DISPATCH = 12, /* scheduler-dispatch-commit: durable record of a
* job's synchronous dispatch-time transition to
* running, distinct from (and independent of)
* WAL_JOB_START's later worker-confirmed-start
* fact. Payload is wal_jobstate_t{jobid, state,
* _pad=0} -- always the legacy absolute-value
* form (no racing same-job fact to defer against,
* since this is the first transition after a job
* leaves PEND). */
WAL_QUEUE_CTRL = 20,
WAL_WORKER_CTRL = 30,
WAL_NOOP = 40, /* Internal: empty payload, replay no-op; appended only at promotion */