feat(ha-repl-hardening): unified replication decision loop (task 3.2)

ha_evaluate_repl_action() pure function: stale tag→PUSH_CONFIG,
lsn<oldest_wal→SEND_SNAPSHOT, lsn<committed→STREAM_WAL, else CONVERGED.
5 tests. Fixed misleading stream_wal_from_zero test name per review.
This commit is contained in:
Rongsong Shen 2026-06-04 16:58:48 +00:00
parent aab41fa609
commit a475ef621f
4 changed files with 176 additions and 1 deletions

View file

@ -81,7 +81,7 @@
- _Boundary: Primary Heartbeat Handler (ha.c)_
- _Depends: 1.1, 1.4_
- [ ] 3.2 Implement unified decision loop in heartbeat reply processing
- [x] 3.2 Implement unified decision loop in heartbeat reply processing
- After updating per-standby tracking, evaluate: tag stale → push config; `lsn < oldest_wal_lsn` → send snapshot; `lsn < committed_lsn` → stream WAL; both current → converged
- One action per heartbeat cycle per standby; `stream_wal_entries()` enqueues all batches non-blocking via `xce_request()` in a single invocation — never blocks vtaskmgr thread
- Log decision at INFO: which standby, which action triggered