test(ha-convergence-recovery): RED ACK-driven catch-up continuation tests + seam (task 4.1)

This commit is contained in:
Rongsong Shen 2026-06-14 05:16:54 +00:00
parent 63c12461a5
commit c2221077ff
6 changed files with 566 additions and 1 deletions

View file

@ -374,3 +374,33 @@ void cluster_apply_ctrlhello_reply(cluster_t *c, uint64_t committed_lsn,
/* Req 2.1–2.3: reconcile a log that runs ahead of the cluster boundary. */
(void)ha_rejoin_reconcile(c, committed_lsn);
}
#ifdef XCE_TESTING
/* ───────────────────────────────────────────────────────────────────────────
* RED scaffold — ha-convergence-recovery task 4.1 (replaced by task 4.2 GREEN).
*
* ha_walack_continuation_for_test stands in for the post-ACK decision that the
* walAck branch of repl_ack_decode_and_dispatch (ha.c) must perform after
* repl_on_ack (D6): derive target = max(committed_lsn, last_written); when the
* standby is still behind target, schedule exactly one catch-up continuation
* (single-flight via ha.catchup_inflight[peer_idx]); at/above target call
* repl_complete_catchup to re-include the standby (Req 7.1).
*
* THIS SCAFFOLD INTENTIONALLY DOES NOTHING beyond recording that the ACK was
* observed (it mirrors the current production walAck branch, which only calls
* repl_on_ack). It does NOT schedule a continuation and does NOT call
* repl_complete_catchup — so the continuation / single-flight / parity tests in
* test_convergence_verification.c FAIL (RED) until task 4.2 implements the real
* decision here and wires it into the production walAck branch.
* ─────────────────────────────────────────────────────────────────────────── */
int ha_walack_continuation_for_test(cluster_t *c, void *ep, int peer_idx,
uint64_t acked_lsn)
{
/* RED scaffold — task 4.2 replaces this body with the D6 decision. */
(void)c;
(void)ep;
(void)peer_idx;
(void)acked_lsn;
return 0;
}
#endif /* XCE_TESTING */