feat(ha-convergence-recovery): self-restart primitive + demotion convergence (task 2.2)

This commit is contained in:
Rongsong Shen 2026-06-14 03:47:12 +00:00
parent c8e55947c2
commit 09103a3141
7 changed files with 337 additions and 43 deletions

View file

@ -273,6 +273,26 @@ char **controller_saved_argv(void);
*/
int ha_self_restart(cluster_t *c);
/*
* ha_schedule_demotion_convergence: schedule the one-shot delaymgr task that
* truncates above committed_lsn (Req 1.2), WARN-logs the discarded range
* (Req 1.5), and self-restarts (Req 1.3). Called from raft_cb_become_follower's
* was-PRIMARY branch AFTER the persistence hooks are disabled inline (Req 1.1),
* so all file I/O and the exec run off the become-follower callback thread (D1).
* Returns 0 on success, negative on alloc/schedule failure (suffix is then
* reconciled by rejoin reconciliation at the next join).
*/
int ha_schedule_demotion_convergence(cluster_t *c);
#ifdef XCE_TESTING
/*
* ha_demotion_convergence_fn: the delaymgr task body — exposed under XCE_TESTING
* only so the demotion-convergence suite can reference its contract; the test
* fixture drives the queued task through its stored entry pointer.
*/
int ha_demotion_convergence_fn(void *arg);
#endif
/* ── Redirect helpers used by join.c ──────────────────────── */