myxce/.kiro/specs/ha-entity-snapshots
Rongsong Shen 8d1ee8b761 feat(ha-entity-snapshots): track in-flight snapshot transfer LSN per peer (task 4.1)
Adds snapshot_inflight_lsn[MAX_HA_CANDIDATES] to ha_state_t, alongside the
existing snapshot_inflight[] flag it mirrors exactly: set to the
checkpoint's LSN at ha_snapshot_send_dispatch before a transfer's first
byte goes out, cleared to 0 at every completion/failure path
(snapshot_lane_fn's normal completion, and all 3 early-return failure
sites: malloc failure, slowlane dedup-refuse, slowlane submit failure).

This is the foundation task 4.3 will consult from rotate_snapshots to
avoid deleting a checkpoint file a peer is still mid-transfer reading
from -- the one genuinely new retention guard this feature needs (the
existing write_snapshot-before-trim_wal_segments sequencing already
satisfies the WAL-trim side of Requirement 3).

Proven via a new gated unit test (test_ha_liveness.c) that observes the
tracked LSN mid-flight while the send body is parked at a test gate, not
just before/after -- confirms the lifecycle ordering, not just the
endpoints.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JDYFbrgyDHbvNYcxApKhrX
2026-07-01 07:26:44 +00:00
..
design.md feat(ha-entity-snapshots): add spec + task 1.1 test fixture 2026-07-01 04:55:55 +00:00
requirements.md feat(ha-entity-snapshots): add spec + task 1.1 test fixture 2026-07-01 04:55:55 +00:00
research.md feat(ha-entity-snapshots): add spec + task 1.1 test fixture 2026-07-01 04:55:55 +00:00
spec.json feat(ha-entity-snapshots): add spec + task 1.1 test fixture 2026-07-01 04:55:55 +00:00
tasks.md feat(ha-entity-snapshots): track in-flight snapshot transfer LSN per peer (task 4.1) 2026-07-01 07:26:44 +00:00