feat(ha-config-bootstrap): implement vote handlers and term persistence (task 4.2)
- ha_persist_term(): atomic write+rename of ha_term_file_t with CRC32 - handle_request_vote(): term/voted_for/freshness/catch-up gate chain - handle_request_vote_reply(): vote counting, quorum+all-replied signaling - ha_elect_evaluate_and_signal(): quorum+yield+zero-config gates (4.3 early) - am_i_primary_quorum(): single-node shortcircuit + 2-round retry (4.3 partial) - 24 Tests 0 Failures in test_ha_election suite
This commit is contained in:
parent
403dd17f8b
commit
0f88d5d32a
4 changed files with 538 additions and 1 deletions
|
|
@ -91,7 +91,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
|
|||
- `make test` fails
|
||||
- _Requirements: 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12_
|
||||
|
||||
- [ ] 4.2 Implement handle_request_vote() and ha_persist_term()
|
||||
- [x] 4.2 Implement handle_request_vote() and ha_persist_term()
|
||||
- `ha_persist_term()`: write `ha_term_file_t` (magic + term + voted_for_term + voted_for_name + CRC32) atomically to `{workdir}/ha-term.bin` via write+rename
|
||||
- `handle_request_vote()`: if `req->term < my_term` → deny; if `req->term > my_term` → update term, clear voted_for, persist; if already voted for different candidate → deny; if `req->config_tag < my_tag || (eq_tag && req->last_lsn < my_lsn)` → deny; otherwise → grant, set `voted_for_name`, persist, reply
|
||||
- `handle_request_vote_reply()`: update `ha_elect_ctx_t` entry; post `ctx->done` when quorum reached or all replied
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue