myxce/src/include
Rongsong Shen 45400c3a28
fix(controller): close 6 data-safety races + apply-pump O(N^2) regression + boot TOCTOU
Bundles the fixes validated this session across ha.c/persist.c/worker.c:

- raft-apply-decoupling Task 7.4: apply-pump O(N^2) throughput regression
  fixed via a segment-read cache.
- bug-1416: boot-time TOCTOU race in persist_verify_apply_correctness()
  closed with a recovery-complete gate that closes at process-lifecycle
  start, not function entry.
- bug-451: HOOK_DETAIL_JOB_RUSAGE_UPDATE now has its own persist hook arm
  instead of silently falling through the default job-state case.
- bug-1426: trim_wal_segments() also caps its trim floor at the local
  apply pump's own progress, not just remote standby-acked positions.
- bug-1427: persist_verify_apply_correctness() extended with a worker-count
  check mirroring the existing job-count check (count_jobmgr_entries and
  count_workermgr_entries now share one count_manager_entries(var) helper).
- bug-1428: persist_register_pending_apply's critical section widened to
  close the actual race instead of patching a symptom.
- bug-1472 (remainder): WORKER_DEAD replay in worker_from_capnp() now
  applies mark_worker_unavail()'s mutations via a shared
  apply_worker_dead_mutation() helper instead of duplicating them.
- bug-1474 (angle-a): on_standby_connected's stale-duplicate detection
  fixed for promoted vote endpoints via a shared votes_idx_for_peer()
  index-scale converter.

Each fix independently verified via TDD (RED before fix, GREEN after).
Full ASAN rebuild + controller_unit_test: 1101 tests, 0 failures. Live
single-node HA deployment validated Task 7.4 and bug-1416 across 5
restart/recovery cycles (45/45 job submissions, zero APPLY_DIVERGENT
fences).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 10:20:02 +00:00
..
xce refactor(controller,xceadmin): drop generic Resource.unit, hardcode bytes for maxmem 2026-08-13 08:27:16 +00:00
attrs.h improve xkvmgr and testsuite for scheduler 2026-02-26 14:39:12 +08:00
bitset.h - introduce bitset 2026-02-13 11:01:33 +08:00
byteorder.h fix: ha_seed_jitter loop-until-full partial read; byteorder.h musl portability 2026-05-13 14:18:43 +00:00
client.h feat(component-failover-adoption): reconcile N_MAX_MASTERS with MAX_HA_CANDIDATES 2026-08-11 04:31:53 +00:00
clusterconfig.h feat(controller): clusterconfig-schema-split task 1.2 — remove dead members from cluster_config_t 2026-07-21 03:13:33 +00:00
config.h fix(raft-ha-core-safety): close 5.10a — WAL segment rotation + endpoint UAF blocking real snapshot catch-up 2026-07-02 04:11:20 +00:00
configobj.h save works 2026-03-03 16:49:26 +08:00
ctrl_metrics.h feat: P3-7 ctrl_metrics — 7 atomic counters/gauges + descriptor table + persist wiring 2026-05-08 00:04:06 +00:00
dataq.h use nix build & meson & zlog 2025-11-03 18:19:59 +08:00
delay.h fix(lib): normalize delaymgr to one CLOCK_MONOTONIC ms timescale, fixing seconds-task starvation 2026-07-02 03:40:08 +00:00
group.h save works 2026-03-03 16:49:26 +08:00
helper.h feat: fill scheduler controller message gaps 2026-05-12 07:01:52 +00:00
hook.h feat: xce_disable_hook() + _Atomic hook_fn_t + NULL-slot reuse (P1-2a) 2026-05-07 13:55:42 +00:00
htab.h reformat code and job array 2025-11-07 16:14:27 +08:00
idgen.h jobid generate 2025-11-07 18:17:34 +08:00
jobj.h save works 2026-03-02 12:14:30 +08:00
kv.h feat: implement kvmgr_capture_keys for lock-free checkpoint serialization (P0-14a) 2026-05-07 11:07:41 +00:00
kvmgr.h fix(job-array-single-wal-record): close bug-1443's bulk-insert partial-visibility gap 2026-07-16 15:08:02 +00:00
misc.h 1st workable scheduler with resource from controller 2025-12-31 15:50:52 +08:00
myconf.h fix(config): serialize load_primary_config against concurrent invocations (bug-1476) 2026-07-28 08:13:54 +00:00
mylock.h feat(libxce-failover): reconnect recovery — ctx ERR->RUN reset + stale wbuf drain (fixes post-failover EINVAL) (task 3.2) 2026-06-17 03:36:24 +00:00
netio.h fix(component-failover-adoption): Phase 6 -- close apiserver's idle-period rejoin gap (bug-1548/bug-1549) 2026-08-16 03:42:03 +00:00
objs.h update controller code 2025-11-05 16:58:57 +08:00
ordq.h pass pend reason back to controller 2025-12-23 15:29:26 +08:00
persist.h fix(controller): close 6 data-safety races + apply-pump O(N^2) regression + boot TOCTOU 2026-08-16 10:20:02 +00:00
preason.h scheduling using real slots number 2025-12-30 18:13:15 +08:00
qobj.h save works 2026-03-02 12:14:30 +08:00
repl.h fix(ha): close permanent quorum-loss deadlock on log-conflicted standby (bug-1479) 2026-07-29 04:11:32 +00:00
request.h feat(scheduler-core): add controller-side OPCode_schedAdmin dispatch (task 10.1) 2026-08-06 03:38:42 +00:00
resobj.h save works 2026-03-03 16:49:26 +08:00
resreq.h fix select eval ctx share 2026-05-07 04:37:18 +00:00
typemap.h feat(controller): OPCode_probeConfigTag handler with Request envelope reply (bug-1506) 2026-08-10 10:00:08 +00:00
utils.h fix(persist): zero nresvals_to_sched after free_name_val_list 2026-05-20 09:39:07 +00:00
vtaskmgr.h feat(raft-drive-async): peer-control vtask dispatch shim, dormant (task 3.1) 2026-06-26 11:12:04 +00:00
wal_types.h feat(job-array-single-wal-record): add WAL_JOB_ARRAY_SUBMIT record type 2026-07-14 06:47:14 +00:00
wobj.h save works 2026-03-02 12:14:30 +08:00
xcealloc.h scheduling using real slots number 2025-12-30 18:13:15 +08:00
xceapi.h feat(config-upgrade-snapshot): live config-upgrade soak infra + fix bug-1468/bug-1469 (task 8.6) 2026-07-25 15:48:20 +00:00
xcectx.h Merge branch 'working' into job_peek_lchen 2026-07-22 13:57:25 +08:00
xcelimit.h save works 2026-03-03 16:49:26 +08:00
xcelog.h use clang-format to format code 2025-11-25 14:58:09 +08:00
xlist.h support limit 2026-01-12 15:27:54 +08:00
xstring.h save works 2026-03-03 16:49:26 +08:00
xvec.h using xvec related api in scheduler 2026-01-16 18:21:37 +08:00
zarray.h fix(job-array-single-wal-record): close bug-1443's bulk-insert partial-visibility gap 2026-07-16 15:08:02 +00:00