feat: P2-1 repl.h/repl.c — replicator lifecycle, slot management, trim_lsn

Add replicator_t structure with per-standby connection slots (standby_conn_t),
lifecycle (repl_init/repl_fini), slot management (repl_add_standby,
repl_remove_standby, repl_expire_disconnect_slots), ACK tracking
(repl_on_ack), WAL trim guard (repl_trim_lsn), and stubs for
repl_broadcast/repl_wait_ack (wired in P2-3/P2-4).

Uses mylock_t (pthread_mutex_t alias) with mylock_lock/mylock_unlock.
snap_interval_s==0 in repl_expire_disconnect_slots forces immediate expiry
to support deterministic unit testing.

5 new Unity tests all pass; 115 pre-existing controller tests unchanged.
This commit is contained in:
Rongsong Shen 2026-05-07 16:25:03 +00:00
parent 05c00704d3
commit 8ef64a7ee7
5 changed files with 397 additions and 0 deletions

View file

@ -87,8 +87,10 @@ controller_unit_test_src = [
'testsuite/test_ha_cluster.c',
'testsuite/test_ha_redirect.c',
'testsuite/test_p1_integration.c',
'testsuite/test_repl_unit.c',
'persist.c',
'ha.c',
'repl.c',
]
controller_unit_test_deps = [