myxce/src/controller
Rongsong Shen 6c0523b69b feat(raft-drive-async): snapshot SlowLane offload + WAL-trim cursor guard (task 3.2)
Part B (LIVE, default-ON): trim_wal_segments now bounds WAL-segment deletion
by repl_trim_lsn(&p->repl, active_seg_lsn) = min(active segment LSN, every
active standby acked_lsn, every valid disconnected-slot last_disconnected_lsn),
after repl_expire_disconnect_slots ages out stale slot guards. floor <=
active_seg_lsn structurally, so the guard can only preserve more segments,
never delete one a live standby still needs — closes the bug-795/828
trim-vs-cursor race for connected/recently-disconnected standbys (bug-1147
stopgap; empty/cursor=0 join still needs entity-bearing snapshots).

Part A (DORMANT, g_drive_async_snapshot_offload default OFF): ha_snapshot_send_
dispatch routes HA_REPL_SEND_SNAPSHOT inline (flag OFF — byte-for-byte legacy,
on io_worker) or to slowlane_submit+snapshot_lane_fn (flag ON). Send body
factored into ha_snapshot_do_send. Per-peer single-flight via
ha_state_t.snapshot_inflight[] CAS + slowlane key; in-flight flag cleared on
all four terminal paths, mirroring the reconnect offload (task 2.1).

Lands dormant like task 3.1: snapshot_lane_fn borrows a standby endpoint it
does not own, so flag-ON would race io_worker RDHUP teardown (cross-thread UAF,
bug-1197 family). Flag OFF keeps send+teardown serialized on the io_worker.
Task 3.4 is the single gate that flips both this and the peerctrl flag ON after
establishing endpoint-lifetime discipline; bug-1198 stays open by design until
then. The offload flag was initially authored default-ON (would ship the UAF)
and corrected to OFF in ha.c and the ha.h accessor doc (bug-1210).

Tests (controller 196/0, 0 new leaks): test_snapshot_offload_runs_on_lane,
test_snapshot_inline_when_flag_off, test_snapshot_offload_dedups_per_peer,
test_trim_guard_preserves_standby_segments,
test_trim_without_standbys_proceeds_normally. Adversarial cpp-review: GO.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6fDCtXkkEgupu7rUah1y2
2026-06-26 15:43:24 +00:00
..
include feat(raft-drive-async): LivenessAdmission pool reservation + commit fold (tasks 1.6/1.7) 2026-06-26 07:43:19 +00:00
testsuite feat(raft-drive-async): snapshot SlowLane offload + WAL-trim cursor guard (task 3.2) 2026-06-26 15:43:24 +00:00
apiserver.c add kiro skills 2026-05-21 03:41:57 +00:00
CLAUDE.md fix bug-1060 bug-1067 2026-06-24 17:05:43 +08:00
cluster.c feat(raft-drive-async): peer-control vtask dispatch shim, dormant (task 3.1) 2026-06-26 11:12:04 +00:00
commit.c feat(raft-drive-async): LivenessAdmission pool reservation + commit fold (tasks 1.6/1.7) 2026-06-26 07:43:19 +00:00
config_repl.c docs(controller): NOTICE — config upgrade must snapshot state, not re-derive 2026-06-24 09:45:13 +00:00
config_repl.h fix bug-1060 bug-1067 2026-06-24 17:05:43 +08:00
ctrl_metrics.c feat: P3-7 ctrl_metrics — 7 atomic counters/gauges + descriptor table + persist wiring 2026-05-08 00:04:06 +00:00
ctrlstatus.c feat(ha-heartbeat-committed-propagation): migrate last_known_committed_config_tag to _Atomic (task 1.1) 2026-06-20 11:27:46 +00:00
dataex.c fix(persist): zero nresvals_to_sched after free_name_val_list 2026-05-20 09:39:07 +00:00
egress.c feat(ha-convergence-recovery): commit-gated scheduler egress — submit_lsn tagging + watermark gate (task 1.2) 2026-06-14 02:33:36 +00:00
ha.c feat(raft-drive-async): snapshot SlowLane offload + WAL-trim cursor guard (task 3.2) 2026-06-26 15:43:24 +00:00
ha.h feat(raft-drive-async): snapshot SlowLane offload + WAL-trim cursor guard (task 3.2) 2026-06-26 15:43:24 +00:00
ha_convergence.c feat(ha-term-safety): route AppendEntries intake through library + leaderCommit wire (task 3.2) 2026-06-22 08:42:35 +00:00
job.c feat(ha-convergence-recovery): commit-gated scheduler egress — submit_lsn tagging + watermark gate (task 1.2) 2026-06-14 02:33:36 +00:00
join.c feat(libxce-failover): controller populates primary host/port on E_XCE_REDIRECT replies (task 5.3) 2026-06-17 04:16:26 +00:00
main.c feat(ha-commit-durability): add --wal-sync-ms flush-cadence override (task 1.1) 2026-06-18 04:46:01 +00:00
meson.build feat(raft-drive-async): LivenessAdmission pool reservation + commit fold (tasks 1.6/1.7) 2026-06-26 07:43:19 +00:00
misc.c save works 2026-03-05 16:03:37 +08:00
myapp.c feat(ha-term-safety): out-of-band config bytes, hash-verify-before-activate, serve-fence (task 4.3) 2026-06-22 11:47:15 +00:00
myconf.c feat(ha-config-bootstrap): implement --vcpus CLI, wire validation, remove vcpus from config (task 2.2) 2026-05-28 04:17:06 +00:00
opget.c fix(persist): zero nresvals_to_sched after free_name_val_list 2026-05-20 09:39:07 +00:00
opupd.c save works 2026-03-03 16:49:26 +08:00
persist.c feat(raft-drive-async): snapshot SlowLane offload + WAL-trim cursor guard (task 3.2) 2026-06-26 15:43:24 +00:00
queue.c feat(ha-commit-barrier-rollout): commit-first-then-reply in all four handlers (task 3.2) 2026-06-12 10:28:25 +00:00
repl.c feat(ha-term-safety): retire term-0 repl_broadcast live send; carry leader term on replication (task 3.4) 2026-06-22 15:45:14 +00:00
reply.c fix(persist): zero nresvals_to_sched after free_name_val_list 2026-05-20 09:39:07 +00:00
resources.c update controller code 2025-11-05 16:58:57 +08:00
sched.c feat(ha-convergence-recovery): commit-gated scheduler egress — submit_lsn tagging + watermark gate (task 1.2) 2026-06-14 02:33:36 +00:00
slowlane.c feat(raft-drive-async): SlowLane bounded executor for long blocking I/O (task 1.2) 2026-06-26 05:24:00 +00:00
startup_validation.c feat(ha-heartbeat-liveness): add validate_heartbeat_config startup check (task 1.2) 2026-06-01 12:26:29 +00:00
task.c save works 2026-03-04 18:18:53 +08:00
worker.c feat(ha-commit-barrier-rollout): commit-first-then-reply in all four handlers (task 3.2) 2026-06-12 10:28:25 +00:00