myxce/src/controller
Rongsong Shen abefc8a128 feat: P2-2 apply_wal_entry — standby WAL replay with LSN advance and type guards
Upgrade apply_wal_entry() from P0 static no-op stub to the real public
standby replay path:

- Reject oversized payloads (> MAX_WAL_PAYLOAD_BYTES) with -EMSGSIZE
- Skip WAL_CHECKPOINT (100) entries silently — local-only markers, never
  replicated to standbys; current_lsn is NOT advanced on skip
- Skip unknown types (> WAL_ENTRY_TYPE_MAX) with WARN log and rc=0 for
  forward compatibility with WAL written by newer controller versions
- Advance current_lsn to hdr->lsn+1 and update last_crc under p->lock
  for all accepted known entries
- Gate restore_job()/worker_from_capnp() calls on p->cluster != NULL so
  unit tests work without a full cluster wired in
- Add NULL guard returning -EINVAL for missing p or hdr

Add public declaration in persist.h with forward-declare stubs for
restore_job/worker_from_capnp in persist.c (avoids heavy cluster.h chain).

Test suite: 5 new Unity tests in test_repl_apply.c covering all branches.
Weak stubs for restore_job/worker_from_capnp in the test file satisfy the
linker without linking job.c/worker.c's heavy dependency graph.
All 5 new tests pass; full controller suite green.
2026-05-07 16:38:20 +00:00
..
include feat: implement persist_recover with snapshot load and WAL replay (P0-4) 2026-05-07 11:41:33 +00:00
testsuite feat: P2-2 apply_wal_entry — standby WAL replay with LSN advance and type guards 2026-05-07 16:38:20 +00:00
apiserver.c fix typo caused dead lock 2026-05-07 09:07:36 +00:00
CLAUDE.md Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
cluster.c feat: wire ha_state_t into cluster_t + HA startup/shutdown lifecycle (P1-5) 2026-05-07 14:55:48 +00:00
dataex.c save works 2026-03-05 16:03:37 +08:00
ha.c feat: ha_should_redirect + join.c HA redirect/nomaster guard (P1-6) 2026-05-07 15:11:53 +00:00
ha.h feat: ha_should_redirect + join.c HA redirect/nomaster guard (P1-6) 2026-05-07 15:11:53 +00:00
job.c feat: JOB_STAT_TRANSIENT, job_should_retain, worker_should_retain, dead_since (P0-5a, P0-8, P0-13) 2026-05-07 12:52:07 +00:00
join.c feat: ha_should_redirect + join.c HA redirect/nomaster guard (P1-6) 2026-05-07 15:11:53 +00:00
main.c feat: wire persist_init/recover/start/stop into cluster lifecycle (P0-F) 2026-05-07 13:07:47 +00:00
meson.build feat: P2-2 apply_wal_entry — standby WAL replay with LSN advance and type guards 2026-05-07 16:38:20 +00:00
misc.c save works 2026-03-05 16:03:37 +08:00
myapp.c reformat code and job array 2025-11-07 16:14:27 +08:00
myconf.c save works 2026-03-03 16:49:26 +08:00
opget.c save works 2026-03-04 18:18:53 +08:00
opupd.c save works 2026-03-03 16:49:26 +08:00
persist.c feat: P2-2 apply_wal_entry — standby WAL replay with LSN advance and type guards 2026-05-07 16:38:20 +00:00
queue.c save works 2026-03-04 18:18:53 +08:00
repl.c feat: P2-1 repl.h/repl.c — replicator lifecycle, slot management, trim_lsn 2026-05-07 16:25:03 +00:00
repl.h feat: P2-1 repl.h/repl.c — replicator lifecycle, slot management, trim_lsn 2026-05-07 16:25:03 +00:00
reply.c save works 2026-03-03 16:49:26 +08:00
resources.c update controller code 2025-11-05 16:58:57 +08:00
sched.c save works 2026-03-04 18:18:53 +08:00
task.c save works 2026-03-04 18:18:53 +08:00
worker.c feat: JOB_STAT_TRANSIENT, job_should_retain, worker_should_retain, dead_since (P0-5a, P0-8, P0-13) 2026-05-07 12:52:07 +00:00