feat(ha-repl-hardening): primary snapshot chunk sender (task 3.5a)

ha_send_snapshot_to_standby reads snapshot file, splits into 64KB
chunks, sends each via OPCode_snapshotTransfer with correct metadata
(snapshotLsn, chunkIndex, chunkOffset, totalSize, isLast). Payload
encoding deferred. Hook seam for unit testing.
2 tests: 128KB/2-chunks, small-file/1-chunk. Tasks 3.5b-3.5d remain.
This commit is contained in:
Rongsong Shen 2026-06-05 01:16:34 +00:00
parent 6b69a47c50
commit 834ab4d5e7
5 changed files with 241 additions and 11 deletions

View file

@ -155,6 +155,11 @@ int handle_upgrade_config(cluster_t *c, endpoint_t *ep, xce_request_t *req);
int ha_stream_wal_to_standby(endpoint_t *ep, const char *wal_path,
uint64_t standby_lsn, uint64_t committed_lsn);
#define SNAPSHOT_CHUNK_SIZE 65536
int ha_send_snapshot_to_standby(endpoint_t *ep, const char *snap_dir,
uint64_t checkpoint_lsn, uint64_t total_size);
/*
* handle_ctrlhello: primary-side handler for OP_hello from a joining standby.
*