feat(raft-ha-core-safety): establish snapshot (term,lsn) boundary on install (task 3.2)
Adds checkpointTerm (@6, append-only) to the SnapshotTransfer wire message. The leader stamps it via persist_entry_term(p, checkpoint_lsn) when sending a snapshot; the standby reconciles it into its own per-LSN term index (persist_reconcile_checkpoint_term) right after persist_load_snapshot succeeds, before applied_lsn advances. This authoritatively overwrites any stale local term a divergent pre-snapshot entry left at the checkpoint LSN, closing the gap task 3.1's RED test proved (Expected 7 Was 3 -> now passes). Transport stays persist_t-free; the reconcile lives in persist.c per the existing dependency direction. Decode is auto-generated via capnp mapname; only the hand-rolled encode path (request.c/typemap.h, needed for the raw snapshot payload) required a matching manual update. test_ha_core_safety 25/0, test_config_repl 66/0, no ASAN reports.
This commit is contained in:
parent
21858faba4
commit
a53b9a7b6c
11 changed files with 132 additions and 23 deletions
|
|
@ -632,11 +632,14 @@ int xce_snapshot_chunk_encode_raw(const snapshot_transfer_t *chunk,
|
|||
memset(&rq, 0, sizeof(rq));
|
||||
memset(&st, 0, sizeof(st));
|
||||
|
||||
st.snapshotLsn = chunk->snapshot_lsn;
|
||||
st.chunkIndex = chunk->chunk_index;
|
||||
st.chunkOffset = chunk->chunk_offset;
|
||||
st.totalSize = chunk->total_size;
|
||||
st.isLast = chunk->is_last ? 1 : 0;
|
||||
st.snapshotLsn = chunk->snapshot_lsn;
|
||||
st.chunkIndex = chunk->chunk_index;
|
||||
st.chunkOffset = chunk->chunk_offset;
|
||||
st.totalSize = chunk->total_size;
|
||||
st.isLast = chunk->is_last ? 1 : 0;
|
||||
/* raft-ha-core-safety task 3.2: checkpoint's term at snapshotLsn, so the
|
||||
* receiver can reconcile its per-LSN term index at the boundary. */
|
||||
st.checkpointTerm = chunk->checkpoint_term;
|
||||
if (payload && payload_len > 0) {
|
||||
capn_list8 pl = capn_new_list8(cs, (int)payload_len);
|
||||
capn_setv8(pl, 0, payload, (int)payload_len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue