feat(ha-repl-hardening): safe_committed_lsn from vote replies (task 4.1)
- Add ha_compute_safe_committed_lsn() in ha.c: collects LSNs from granted voters (self + peers), sorts descending, picks index floor(n_granted/2) for majority-threshold value - Wire into raft_cb_become_leader: compute safe_lsn/safe_tag from ha->elect_ctx after winning election, call persist_truncate_wal_above - Four unit tests in test_ha_evaluate_committing.c: voters [99,100]+self=100 → 100; voters [50,51]+self=100 → 51; single-node → 0; denied voter excluded → self-only
This commit is contained in:
parent
18ad3e9c9f
commit
e7919304c3
4 changed files with 314 additions and 1 deletions
|
|
@ -147,7 +147,7 @@
|
|||
---
|
||||
|
||||
- [ ] 4. Post-election safety: Safe commit point from vote replies
|
||||
- [ ] 4.1 Determine `safe_committed_lsn` from vote replies in `raft_cb_become_leader`
|
||||
- [x] 4.1 Determine `safe_committed_lsn` from vote replies in `raft_cb_become_leader`
|
||||
- `ha_elect_ctx_t.votes[]` is already populated by the vote reply handler (`peerLastLogLsn`, `peerConfigTag` per voter); this task reads those fields after winning election
|
||||
- Compute `safe_committed_lsn` = max LSN held by a majority of voters (iterate all voters with `granted=true`)
|
||||
- Compute `safe_config_tag` from `peerConfigTag` using the same majority logic
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue