feat(ha-term-safety): on_send_append_entries callback body (task 2.3)
Replaces the stub: builds a WalCatchupEntry AppendEntries to standbys[peer_idx].ep carrying prev_log_index/prev_log_term; for n_entries==1 sources the entry at prev_log_index+1 from the local WAL (term via persist_entry_term, type+payload via ha_read_wal_entry_at); n_entries==0 emits a zero-entry heartbeat. Async send (xce_wal_batch_req_raw), payload freed on all paths. 2 tests via a capture seam. Review-applied: corrected the misleading repl.c comment — leader_commit is accepted but NOT yet wire-encoded (deferred to task 3.2: WalCatchupEntry leaderCommit field + standby intake). Reviewer APPROVED; per-group 0 failures.
This commit is contained in:
parent
ed2443533f
commit
2c5d298cb5
6 changed files with 452 additions and 4 deletions
|
|
@ -789,6 +789,20 @@ uint64_t ha_cb_get_entry_term_for_test(ha_state_t *ha, uint64_t index);
|
|||
* member stays non-promotable). TEST-ONLY.
|
||||
*/
|
||||
int ha_cb_truncate_from_for_test(ha_state_t *ha, uint64_t index);
|
||||
|
||||
/*
|
||||
* ha_cb_send_append_entries_for_test (ha-term-safety task 2.3): invoke the WIRED
|
||||
* on_send_append_entries callback directly so a unit test exercises the real
|
||||
* AppendEntries send body — peer→endpoint mapping, prev-tuple + leader_commit
|
||||
* carry, and (for n_entries==1) sourcing the single entry at prev_log_index+1
|
||||
* from the leader's own WAL. Combine with repl_send_ae_capture_hook to assert
|
||||
* the built envelope content without network I/O. Returns the callback rc.
|
||||
* TEST-ONLY.
|
||||
*/
|
||||
int ha_cb_send_append_entries_for_test(ha_state_t *ha, int peer_idx,
|
||||
uint64_t prev_log_index,
|
||||
uint64_t prev_log_term,
|
||||
uint64_t leader_commit, int n_entries);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue