feat(job-array-single-wal-record): wire array expansion into apply_wal_entry

Adds case WAL_JOB_ARRAY_SUBMIT to apply_wal_entry() (standby
catch-up dispatch), calling restore_job_array() hook-free, matching
the existing WAL_JOB_SUBMIT case's shape exactly.

Review found apply_wal_entry() has zero production call sites -- a
2026-07-10 refactor (ha_standby_advance_committed_and_apply) moved
standby entity materialization onto the same apply_committed_entry()
pump the primary uses; the code comment claiming otherwise predated
that refactor and was never updated. Requirement 3.1/3.2/4.1 are
fully delivered by task 3.2 alone. This task's wiring is kept as
defensive parity with WAL_JOB_SUBMIT's existing, equally-dead case
in the same switch, not as an independent delivery path -- design.md
and tasks.md corrected accordingly.

Task 3.3 of job-array-single-wal-record.
This commit is contained in:
Rongsong Shen 2026-07-15 02:30:06 +00:00
parent 0c4573b54a
commit b0c7cfe548
4 changed files with 260 additions and 12 deletions

View file

@ -2627,6 +2627,27 @@ int apply_wal_entry(persist_t* p, uint32_t type, uint64_t lsn,
restore_job(p->cluster, 0, payload, payload_len, lsn);
break;
case WAL_JOB_ARRAY_SUBMIT:
/* job-array-single-wal-record task 3.3 (design.md "Array Apply
* Expansion"): the array-record analog of WAL_JOB_SUBMIT's
* restore_job() call directly above, dispatched from this SEPARATE,
* still-live standby catch-up / replicated-apply seam so it can
* never diverge from apply_committed_entry()'s WAL_JOB_ARRAY_SUBMIT
* case (Req 3.1, 3.2, 4.1). Mirrors the single-job case's exact
* minimalism: no xlist_t, no hook fire — this dispatcher is
* deliberately hook-free (standby catch-up does not notify the
* local scheduler/API server; that is the primary's job, done via
* apply_committed_entry()). out_new_jobs is not needed here, so
* NULL is passed (restore_job_array()'s out_new_jobs parameter is
* optional — see test_rja_out_new_jobs_is_optional,
* test_job_array_apply.c). The return value is intentionally
* discarded, matching every other case in this switch today (task
* 4.1 — Live Apply Resource Fence — is what later makes this
* function's callers respect a negative rc; not this task's
* boundary). */
restore_job_array(p->cluster, payload, payload_len, lsn, NULL);
break;
case WAL_JOB_START:
case WAL_JOB_FINISH:
case WAL_JOB_FAIL: