feat(job-array-single-wal-record): add WAL_JOB_ARRAY_SUBMIT record type

Adds the array-shaped WAL entry type (distinct from WAL_JOB_SUBMIT,
value 11 in the unused WAL_JOB_* gap) and classifies it WAIT-mode via
wal_classify, matching the single-job type's commit-barrier semantics.
No dispatch/apply wiring yet -- foundation for task 2.x/3.x.

Task 1.1 of job-array-single-wal-record.
This commit is contained in:
Rongsong Shen 2026-07-14 06:47:14 +00:00
parent 895a204438
commit 2e62e73d84
4 changed files with 197 additions and 0 deletions

View file

@ -4517,6 +4517,12 @@ wal_commit_mode_t wal_classify(uint32_t wal_type, int detail)
/* client job submit — request-shaped; keeps the in-hook sync path
* (reference implementation, handle_jobsubmit) */
return WAL_MODE_WAIT;
case WAL_JOB_ARRAY_SUBMIT:
/* client job-array submit (job-array-single-wal-record task 1.1) —
* request-shaped exactly like WAL_JOB_SUBMIT: one requester awaits
* the single commit barrier before reply, regardless of array
* size. */
return WAL_MODE_WAIT;
case WAL_QUEUE_CTRL:
/* client queue control — request-shaped; the handler barrier owes
* commit completion before the requester reply (tasks 2-3) */

View file

@ -171,6 +171,22 @@ static void test_classify_job_submit_is_wait(void)
printf("test_classify_job_submit_is_wait: PASS\n");
}
static void test_classify_job_array_submit_is_wait(void)
{
/* Arrange / Act */
wal_commit_mode_t mode = wal_classify(WAL_JOB_ARRAY_SUBMIT,
HOOK_DETAIL_JOB_NEW);
/* Assert: a job-array submission is request-shaped exactly like a
* single-job submission — one requester awaiting the commit barrier
* before reply (job-array-single-wal-record task 1.1) */
TEST_ASSERT_EQUAL_INT_MESSAGE(WAL_MODE_WAIT, mode,
"WAL_JOB_ARRAY_SUBMIT must classify WAIT (request-shaped, same as "
"WAL_JOB_SUBMIT)");
printf("test_classify_job_array_submit_is_wait: PASS\n");
}
static void test_classify_queue_ctrl_is_wait(void)
{
/* Arrange / Act */
@ -266,6 +282,7 @@ static void test_classify_is_total_over_wal_entry_type(void)
const char *name;
} all_types[] = {
{ WAL_JOB_SUBMIT, HOOK_DETAIL_JOB_NEW, "WAL_JOB_SUBMIT" },
{ WAL_JOB_ARRAY_SUBMIT, HOOK_DETAIL_JOB_NEW, "WAL_JOB_ARRAY_SUBMIT" },
{ WAL_JOB_START, HOOK_DETAIL_JOB_START, "WAL_JOB_START" },
{ WAL_JOB_FINISH, HOOK_DETAIL_JOB_EXIT, "WAL_JOB_FINISH" },
{ WAL_JOB_FAIL, HOOK_DETAIL_JOB_FAIL, "WAL_JOB_FAIL" },
@ -1714,6 +1731,7 @@ void test_commit_barrier_rollout(void)
UNITY_BEGIN();
/* Task 1.1 — classification totality + RETAIN routing (Req 2.1, 2.2, 3.1) */
RUN_TEST(test_classify_job_submit_is_wait);
RUN_TEST(test_classify_job_array_submit_is_wait);
RUN_TEST(test_classify_queue_ctrl_is_wait);
RUN_TEST(test_classify_worker_ctrl_detail_split);
RUN_TEST(test_classify_all_job_state_types_are_retain);

View file

@ -110,6 +110,10 @@ typedef enum {
WAL_JOB_RUSAGE = 8,
WAL_JOB_CKPT = 9,
WAL_JOB_PREASON = 10,
WAL_JOB_ARRAY_SUBMIT = 11, /* job-array-single-wal-record: one record for
* the whole array (base spec + index range),
* distinct from WAL_JOB_SUBMIT's single-job
* format, which stays unchanged. */
WAL_QUEUE_CTRL = 20,
WAL_WORKER_CTRL = 30,
WAL_NOOP = 40, /* Internal: empty payload, replay no-op; appended only at promotion */