myxce/src
Rongsong Shen 9821ec4f3c fix(ha): election-safety hardening — vote gates, restored-vote term, freshness source
Election protocol fixes validated against raft.tla invariants:

- ha_init_raft(): one-time raft state init at startup (re-init would lose
  durable election progress); n_peers = full cluster size including self
- handle_request_vote(): higher-term step-down moved BEFORE the role gate
  (split-brain fix); standby vote-deny now requires a live primary control
  channel (primary_ctrl_fd >= 0) AND a fresh heartbeat
- ha_heartbeat_is_fresh(): derive freshness from ha->last_activity (the
  field production actually writes); the orphaned last_heartbeat timespec
  had no production writer, leaving the vote-deny gate inert (bug-337);
  field removed from ha_state_t
- handle_request_vote(): restore same-candidate idempotent re-grant —
  deny only a DIFFERENT candidate in the same term, matching raft.c and
  Raft §5.2 votedFor ∈ {Nil, candidateId} (bug-338)
- raft_init(): restore voted_for_term alongside a persisted vote; leaving
  it 0 allowed a double vote in the same term across a restart (bug-339)
- myapp_run(): leader_known check treats a vote recorded under this node's
  own name as a self-vote — production persists the real candidate name,
  the "self" placeholder only appears in test mode
- raft_on_vote_request(): leader steps down on higher-term vote request
  instead of denying it

Tests: test_proto_H6_restored_vote_blocks_second_vote added; H1 restore
assertion strengthened; test_ha_vote_gate.c driven through last_activity +
primary_ctrl_fd (the real production fields). Full /xce-build all green
(lib + controller + scheduler + Go suites, 0 failures, ASAN clean).

deploy-ha.sh: start.sh now forwards extra args to the controller binary.
2026-06-10 01:25:39 +00:00
..
autoscaler support shared libxce(for api server) 2026-01-19 11:02:49 +08:00
controller fix(ha): election-safety hardening — vote gates, restored-vote term, freshness source 2026-06-10 01:25:39 +00:00
docs finalize configuration replication 2026-06-09 16:40:13 +08:00
frontend fix(frontend): remove conf.vcpus from cClusterConfToClusterInfo — field moved to myconf_t 2026-05-29 10:18:01 +00:00
include feat(ha-repl-hardening): standby snapshot receive handler (task 3.5c) 2026-06-05 01:43:05 +00:00
lib fix(ha): election-safety hardening — vote gates, restored-vote term, freshness source 2026-06-10 01:25:39 +00:00
nixSupport Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
scheduler chore: checkpoint all prior work for clean state 2026-06-04 13:04:16 +00:00
schema feat(ha-repl-hardening): add snapshot chunk fields to capnp schema (task 1.3) 2026-06-04 13:55:45 +00:00
tools fix(ha): election-safety hardening — vote gates, restored-vote term, freshness source 2026-06-10 01:25:39 +00:00
worker enhance xce-build skill 2026-05-30 08:13:59 +08:00
build chore: checkpoint all prior work for clean state 2026-06-04 13:04:16 +00:00
flake.lock docs: mark Phase 6 complete in phase6-scheduler-integration-plan 2026-04-30 07:17:32 +00:00
flake.nix save works 2026-03-04 18:18:53 +08:00
meson.build Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
meson.options Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00