refactor(ha-repl-hardening): standardize n_peers = total cluster size including self

- ha_state_t.n_peers now matches raft_config_t.n_peers convention:
  total cluster size (including self), consistently across both layers
- ha_start_election_async: ha->n_peers = n_peers (candidates_count)
- Convergence/counting loops: i < n_peers - 1 (skip self for standby arrays)
- Single-node: n_peers=1, threshold=0 (same behavior, clear semantics)
- ha_elect_ctx_t.n_peers unchanged (separate field for vote array sizing)
- Tests: 3-node n_peers=2->3, single-node 0->1, loop bounds updated

E2E test 6.7: 3-node cluster lifecycle verified
- Initial: ctrl-1 PRIMARY via majority convergence, no degraded mode
- Kill primary: RDHUP detected on both standbys, ctrl-2 elected at term=4
- No data loss: config tag preserved across failover
- Full ASAN build green
This commit is contained in:
Rongsong Shen 2026-06-05 09:57:23 +00:00
parent 361397ac02
commit f236d320a2
4 changed files with 71 additions and 31 deletions

View file

@ -248,7 +248,7 @@
- Verify standby converges and enters `CTRL_STANDBY`
- _Requirements: 4.1, 4.2, 4.5_
- [ ] 6.7 E2E test: full cluster lifecycle
- [x] 6.7 E2E test: full cluster lifecycle
- Deploy 3 nodes via `/xce-deploy-ha`; verify single PRIMARY, zero degraded mode
- Kill primary; verify standby promotes via RDHUP → election → majority convergence
- Verify promoted primary serves from committed state (no data loss)