test(ha-commit-engine): RED integration tests for ACK feed and sync-append (task 5.1)

Tests 30-34: wired repl_on_ack feeds engine, membership mutators
trigger re-evaluation, per-entry sync-append contract (stale-ACK
rejection, committed_lsn unmoved on timeout, n_peers=1 replaces
-ENODEV). test_repl_majority walAck cases rewired to per-LSN
semantics (configAck byte-identical). Sanctioned scaffolding:
entry_lsn param on repl_wait_majority_ack (legacy body byte-identical,
callers pass 0), inert repl_set_commit_engine stub. 9 RED failures;
baseline signatures unchanged. LSN-0 edge documented for 5.2/5.3.
This commit is contained in:
Rongsong Shen 2026-06-11 23:09:05 +00:00
parent c9154bd5cc
commit d1353360cc
9 changed files with 512 additions and 79 deletions

View file

@ -18,6 +18,10 @@
/* Endpoint is an opaque pointer — full type in netio.h (avoid heavy include) */
typedef void* repl_ep_t;
/* Commit engine (controller/include/commit.h) — forward-declared so repl.h
* keeps zero controller-header dependencies (ha-commit-engine task 5). */
struct commit_engine;
/* Per-standby connection slot */
typedef struct {
repl_ep_t ep; /* NULL = slot empty */
@ -70,8 +74,16 @@ void repl_on_config_ack(replicator_t *r, repl_ep_t ep, uint64_t acked_config_lsn
/* Sync replication (stub in P2-1; wired in P2-3) */
int repl_wait_ack(replicator_t *r, uint64_t target_lsn, uint32_t timeout_ms);
/* Majority-quorum ACK wait (task 7.3) */
int repl_wait_majority_ack(replicator_t *r, uint32_t timeout_ms, uint8_t ack_op);
/* Majority-quorum ACK wait (task 7.3; ha-commit-engine task 5 adapter).
* entry_lsn: the WAL entry the caller waits on. The walAck branch delegates
* to the commit engine for per-LSN evaluation when wired (task 5.2); the
* legacy counting body ignores it. configAck callers pass 0 (ignored). */
int repl_wait_majority_ack(replicator_t *r, uint64_t entry_lsn,
uint32_t timeout_ms, uint8_t ack_op);
/* Wire the commit engine into the replicator so ACK and membership events
* are fed to it (ha-commit-engine task 5.2; NULL = not wired). */
void repl_set_commit_engine(replicator_t *r, struct commit_engine *ce);
/* WAL trim guard */
uint64_t repl_trim_lsn(replicator_t *r, uint64_t checkpoint_lsn, uint32_t snap_interval_s);