feat(ha-commit-durability): durable-backed vote/PreVote freshness floor + bare-durable candidate advertise (task 4.2)
This commit is contained in:
parent
4b7457144c
commit
3049b620f3
7 changed files with 282 additions and 26 deletions
|
|
@ -218,17 +218,23 @@ int myapp_run(myconf_t *myconf)
|
|||
}
|
||||
}
|
||||
|
||||
/* Advertise the EFFECTIVE freshness floor — identical to the voter-side
|
||||
* floor (cluster.c OPCode_requestVote) and to the RDHUP failover path
|
||||
* (ha_on_primary_ctrl_fd_rdhup): max(applied_lsn, last_known_committed_lsn)
|
||||
* at the effective config tag. Candidate-advertised LSN must equal what a
|
||||
* peer would compute as its voter floor, otherwise two equally-fresh nodes
|
||||
* mutually deny each other's votes and no leader is ever elected. */
|
||||
/* Advertise the candidate freshness for the boot RequestVote payload
|
||||
* (ha-commit-durability task 4.2). TAG axis = the config-epoch fold
|
||||
* ha_vote_self_freshness computes (matches the voter side); LSN axis = the
|
||||
* BARE durable WAL tip persist_durable_floor (via
|
||||
* ha_candidate_advertise_lsn). A candidate may only advertise a log
|
||||
* position it can durably back, so a node booted with a truncated log
|
||||
* cannot over-advertise a stale volatile learned-committed value and win
|
||||
* (design §1a/§5a). The bare durable tip is still the genuine voter-floor
|
||||
* local-state input on the peer side (peers now fold durable_floor, not
|
||||
* applied_lsn), so the most-durable node remains grantable — no livelock
|
||||
* (design §4). */
|
||||
uint64_t local_tag = myconf->config_version_tag;
|
||||
uint64_t local_lsn = (uint64_t)atomic_load_explicit(&c.ha.applied_lsn,
|
||||
memory_order_acquire);
|
||||
uint64_t my_tag = 0, my_lsn = 0;
|
||||
ha_vote_self_freshness(&c.ha, local_tag, local_lsn, &my_tag, &my_lsn);
|
||||
ha_vote_self_freshness(&c.ha, local_tag, local_lsn, &my_tag, NULL);
|
||||
my_lsn = ha_candidate_advertise_lsn(&c.persist);
|
||||
|
||||
/* Initialize raft state machine once with cluster topology.
|
||||
* Must happen before any election or watchdog path that calls
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue