feat(ha-repl-hardening): snapshot transfer integration and dispatch-path tests (task 3.5d)
- Add ha_repl_send_snapshot_hook seam in ha.c/ha.h for XCE_TESTING - test_dispatch_repl_action_send_snapshot: verifies SEND_SNAPSHOT decision triggers hook when standby_lsn < oldest_wal_lsn - test_snapshot_recv_two_chunks_assembles_and_renames: verifies standby assembles snap.part across chunks and renames on isLast=true - test_snapshot_recv_reconnect_discards_snappart: verifies O_TRUNC semantics on chunk_index==0 restart after reconnect - All tests pass under ASAN
This commit is contained in:
parent
cbd91fca43
commit
18ad3e9c9f
5 changed files with 207 additions and 2 deletions
|
|
@ -565,7 +565,8 @@ void ha_repl_ack_received(ha_state_t *ha, cluster_t *c);
|
|||
* - HA_REPL_STREAM_WAL: calls ha_stream_wal_to_standby(ep, wal_path, standby_lsn,
|
||||
* committed_lsn) to batch-stream WAL entries via xce_request() (non-blocking).
|
||||
* In XCE_TESTING builds, calls ha_repl_stream_wal_hook if non-NULL.
|
||||
* - HA_REPL_SEND_SNAPSHOT: stub (Task 3.5).
|
||||
* - HA_REPL_SEND_SNAPSHOT: calls ha_send_snapshot_to_standby(ep, snap_path, lsn).
|
||||
* In XCE_TESTING builds, calls ha_repl_send_snapshot_hook(peer_idx) if non-NULL.
|
||||
* - HA_REPL_CONVERGED: no-op.
|
||||
*
|
||||
* One action per heartbeat cycle per standby (design §Unified Heartbeat-Driven
|
||||
|
|
@ -660,6 +661,20 @@ extern int (*ha_repl_stream_wal_hook)(void *ep, const char *wal_path,
|
|||
uint64_t standby_lsn,
|
||||
uint64_t committed_lsn);
|
||||
|
||||
/*
|
||||
* ha_repl_send_snapshot_hook: test-only seam for ha_send_snapshot_to_standby.
|
||||
*
|
||||
* When non-NULL, ha_dispatch_repl_action_for_standby() calls this INSTEAD OF
|
||||
* ha_send_snapshot_to_standby() when the decision is HA_REPL_SEND_SNAPSHOT,
|
||||
* so unit tests can verify the wiring without requiring a real endpoint or
|
||||
* snapshot directory.
|
||||
*
|
||||
* Signature: int hook(int peer_idx)
|
||||
* peer_idx — 0-based index of the standby that triggered the snapshot
|
||||
* Requirements: 4.1–4.5 (ha-repl-hardening)
|
||||
*/
|
||||
extern int (*ha_repl_send_snapshot_hook)(int peer_idx);
|
||||
|
||||
/*
|
||||
* ha_tcp_connect_hook: test-only seam for the raw TCP connect inside
|
||||
* ha_find_and_connect_to_primary. When non-NULL, the function calls this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue