feat(ha-config-bootstrap): add election types and new fields to ha.h (task 1.2)
- Add CTRL_INIT=2, CTRL_ELECTING=3 to ctrl_role_t - Add ha_vote_entry_t per-peer vote tracking struct - Add ha_elect_ctx_t with C99 flexible array votes[] - Add 8 new ha_state_t fields: voted_for_term/name, primary_ctrl_fd, defer_config_fetch, elect_ctx (void * _Atomic), last_known_committed_lsn, heartbeat_seen (sem_t), last_known_committed_config_tag - Declare ha_persist_term(), bootstrap_config_if_needed(), xce_probe_config_tag() - Fix: use void * _Atomic (postfix) not _Atomic void * (prefix) for atomic pointer-to-void — C11 §6.7.2.4 prohibits _Atomic on incomplete type void
This commit is contained in:
parent
6adb7e806f
commit
560d8fa1c8
2 changed files with 75 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
|
|||
---
|
||||
|
||||
- [ ] 1. Foundation: Wire protocol extensions and shared infrastructure
|
||||
- [ ] 1.1 Add 6 new opcodes and message structs to controller.capnp
|
||||
- [x] 1.1 Add 6 new opcodes and message structs to controller.capnp
|
||||
- Append `requestVote @32`, `probeConfigTag @33`, `walAck @34`, `upgradeConfigAck @35`, `snapshotTransfer @36`, `walCatchupEntry @37` after existing `upgradeConfig @31`
|
||||
- Add structs: `RequestVoteRequest`, `RequestVoteReply`, `ProbeConfigTagRequest`, `ProbeConfigTagReply`, `WalAckRequest`, `WalAckReply`, `UpgradeConfigAck`, `SnapshotTransfer`, `WalCatchupEntry`
|
||||
- Extend `CtrlHeartbeat`: add `committedLsn :UInt64` and `committedConfigTag :UInt64` fields
|
||||
|
|
@ -20,7 +20,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
|
|||
- _Requirements: 2, 3, 5, 6, 7, 8_
|
||||
- _Boundary: Wire Protocol (controller.capnp)_
|
||||
|
||||
- [ ] 1.2 Add new enum values and types to ha.h
|
||||
- [x] 1.2 Add new enum values and types to ha.h
|
||||
- Add `CTRL_INIT=2`, `CTRL_ELECTING=3` to `ctrl_role_t` (values above existing 0/1)
|
||||
- Add `ha_vote_entry_t` struct with fields: `peer`, `my_term`, `my_tag`, `my_lsn`, `vote_granted`, `replied`, `peer_tag`, `peer_lsn`
|
||||
- Add `ha_elect_ctx_t` struct with C99 flexible array `ha_vote_entry_t votes[]`; allocation comment: `calloc(1, sizeof(*ctx) + (n_peers-1) * sizeof(ctx->votes[0]))`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue