feat(ha-commit-engine): repl-side wiring — ACK feed, membership hooks, adapter (task 5.2)

replicator_t gains ce pointer (set-once-before-traffic contract).
repl_on_ack feeds commit_on_ack after releasing r->lock (iomgr-safe);
four membership mutators feed commit_on_membership_change post-unlock,
gated on actual mutation. walAck branch delegates to commit_submit(WAIT)
when ce wired AND entry_lsn != 0 (LSN-0 interim guard until 5.3);
legacy counting kept for ce==NULL, marked DEPRECATED. commit.c linked
into production target (inert until 5.3 wiring). Tests 30-31 + all
repl_majority walAck cases green; 33/34 remain RED for 5.3; baseline
unchanged.
This commit is contained in:
Rongsong Shen 2026-06-11 23:32:59 +00:00
parent d1353360cc
commit 6600fd5d1f
6 changed files with 104 additions and 15 deletions

View file

@ -44,6 +44,12 @@ typedef struct replicator_s {
mylock_t lock; /* Protects standbys[], nstandbys */
pthread_cond_t ack_cond; /* Signaled when any ACK arrives */
pthread_mutex_t ack_lock; /* Guards ack_cond */
/* Commit engine feed (ha-commit-engine task 5.2). NULL = not wired
* (legacy counting contexts). Set once via repl_set_commit_engine at
* cluster init, before replication traffic — read without r->lock.
* Lock ordering: engine paths take ce->lock then r->lock, so repl.c
* must NEVER call into the engine while holding r->lock. */
struct commit_engine *ce;
} replicator_t;
/* Lifecycle */