feat: implement job state, queue state, and worker recovery in WAL replay
WAL payloads:
- Job state transitions (START/FINISH/FAIL/STOP/RESUME/UPDATE etc):
wal_jobstate_t {uint64_t jobid, uint32_t state} — restores exact state flags
- Queue state (QUEUE_CTRL): wal_queuehdr_t {uint32_t status} + name string —
re-applies admin open/close/active/inactive after config queues are built
- Worker CTRL: existing [uint32_t detail][capnp xce_worker_t] unchanged
New recovery functions:
- restore_job_state(c, jobid, state): looks up job, overwrites state flags
- restore_queue_state(c, name, status): looks up queue, overwrites status
apply_wal_entry: dispatches all WAL types including job state and queue
test_repl_apply.c: weak stubs for restore_job_state/restore_queue_state
so unit test binary links without job.c/queue.c
This commit is contained in:
parent
efafcdc6e9
commit
6df3bd5906
5 changed files with 117 additions and 21 deletions
|
|
@ -6,6 +6,23 @@
|
|||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
|
||||
/* ── WAL payload helper structs ────────────────────────────────────────────
|
||||
* These are the binary formats embedded after wal_entry_hdr_t for each type.
|
||||
* All fields are native-endian (single-node WAL; replication uses capnp). */
|
||||
|
||||
/* WAL_JOB_START / FINISH / FAIL / STOP / RESUME / UPDATE / CKPT / PREASON / RUSAGE */
|
||||
typedef struct {
|
||||
uint64_t jobid;
|
||||
uint32_t state; /* xce_job state flags after this transition */
|
||||
uint32_t _pad;
|
||||
} wal_jobstate_t;
|
||||
|
||||
/* WAL_QUEUE_CTRL — queue name is a NUL-terminated string immediately after
|
||||
* this header. Total payload = sizeof(wal_queuehdr_t) + strlen(name)+1. */
|
||||
typedef struct {
|
||||
uint32_t status; /* xce_queue status flags after this transition */
|
||||
} wal_queuehdr_t;
|
||||
|
||||
/* ============================================================
|
||||
* WAL entry header — 40 bytes, 8-byte aligned (Part 2.2)
|
||||
* ============================================================ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue