test(ha-commit-engine): RED tests for write-admission quorum counting (task 4.1)

Tests 21-28: repl_active_standby_count contract (5 RED vs inert -1
stub) + 3 gate-level pins (n_peers<=1 always-true, zero-connected
reject, stateless re-accept) that 4.2 must preserve. Declaration in
repl.h; ha.c/ha.h untouched (4.2 boundary). 28 tests / 5 RED; suite
at the 3-failure baseline with unchanged signatures.
This commit is contained in:
Rongsong Shen 2026-06-11 16:15:21 +00:00
parent 631a08939b
commit b2598823c0
6 changed files with 322 additions and 3 deletions

View file

@ -51,6 +51,12 @@ int repl_add_standby(replicator_t *r, repl_ep_t ep, const char *host, uint32_t
void repl_remove_standby(replicator_t *r, repl_ep_t ep);
void repl_expire_disconnect_slots(replicator_t *r, time_t now_s, uint32_t snap_interval_s);
/* Write-admission quorum accounting (ha-commit-engine Req 3.1-3.3).
* Counts only standbys able to receive new log entries: slots with
* ep != NULL && !in_catch_up, evaluated under r->lock.
* NULL registry counts zero. Consumed by ha_has_write_quorum (ha.c). */
int repl_active_standby_count(replicator_t *r);
/* Replication send (stub in P2-1; wired in P2-4) */
int repl_broadcast(replicator_t *r, const wal_entry_hdr_t *hdr,
const void *payload, uint32_t payload_len);