forked from lei.chen/myxce
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
|
|
@ -378,13 +378,18 @@ static int myreq_handler(vtask_t* task)
|
|||
uint64_t cand_lsn = vrq ? vrq->last_log_lsn : 0;
|
||||
uint64_t cand_term = vrq ? vrq->term : 0;
|
||||
uint64_t local_tag = c->myconf->config_version_tag;
|
||||
uint64_t local_lsn = (uint64_t)atomic_load_explicit(
|
||||
&c->ha.applied_lsn, memory_order_acquire);
|
||||
/* Task 4.2 (ha-commit-durability): the voter floor's local-state LSN
|
||||
* input is the DURABLE WAL tip (persist_durable_floor), not the
|
||||
* volatile applied_lsn. A voter must not demand of a candidate a log
|
||||
* position it itself only holds volatilely, and a truncating restart
|
||||
* must lower this voter's floor to its real durable state. */
|
||||
uint64_t local_lsn = persist_durable_floor(&c->persist);
|
||||
|
||||
/* Election-safety fix #2: the freshness floor is the max of our local
|
||||
* state and our learned-committed cluster state, so we deny candidates
|
||||
* that are outdated against what the cluster has already committed
|
||||
* (not merely against our local config file / applied LSN). */
|
||||
/* Election-safety fix #2 (retained): the freshness floor is the max of
|
||||
* our local DURABLE state and our learned-committed cluster state, so we
|
||||
* deny candidates that are outdated against what the cluster has already
|
||||
* committed — the learned_committed backstop stays on the voter axis
|
||||
* (bug-339 / design §1b). */
|
||||
uint64_t my_tag = 0, my_lsn = 0;
|
||||
ha_vote_self_freshness(&c->ha, local_tag, local_lsn, &my_tag, &my_lsn);
|
||||
|
||||
|
|
@ -463,11 +468,14 @@ static int myreq_handler(vtask_t* task)
|
|||
uint64_t cand_lsn = vrq ? vrq->last_log_lsn : 0;
|
||||
uint64_t cand_term = vrq ? vrq->term : 0;
|
||||
uint64_t local_tag = c->myconf->config_version_tag;
|
||||
uint64_t local_lsn = (uint64_t)atomic_load_explicit(
|
||||
&c->ha.applied_lsn, memory_order_acquire);
|
||||
/* Task 4.2 (ha-commit-durability): voter-floor local-state LSN is the
|
||||
* DURABLE WAL tip (persist_durable_floor), not the volatile applied_lsn
|
||||
* — same change as the real-vote path above. */
|
||||
uint64_t local_lsn = persist_durable_floor(&c->persist);
|
||||
|
||||
/* Effective freshness floor: max of local state and learned-committed
|
||||
* cluster state (election-safety fix #2, reused unchanged). */
|
||||
/* Effective freshness floor: max of local DURABLE state and
|
||||
* learned-committed cluster state (election-safety fix #2 backstop
|
||||
* retained on the voter axis — design §1b). */
|
||||
uint64_t my_tag = 0, my_lsn = 0;
|
||||
ha_vote_self_freshness(&c->ha, local_tag, local_lsn, &my_tag, &my_lsn);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue