test(ha-convergence-recovery): RED clamped rejoin reconciliation tests + intake extraction (task 3.1)
This commit is contained in:
parent
09103a3141
commit
5521720b0c
5 changed files with 300 additions and 9 deletions
|
|
@ -210,3 +210,49 @@ int ha_schedule_demotion_convergence(cluster_t *c)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ha_rejoin_reconcile — RED scaffold (ha-convergence-recovery task 3.1).
|
||||
*
|
||||
* TASK 3.2 REPLACES THIS with the real reconciliation: when the rejoining node's
|
||||
* local WAL tip exceeds the primary-reported committed boundary, truncate above
|
||||
* max(boundary, local committed_lsn) (clamp, Req 2.2), WARN the range, set the
|
||||
* rejoin_reconciled once-guard (Req 2.1), and ha_self_restart (Req 2.1) —
|
||||
* deferred to a delaymgr task if the intake runs on iomgr. Otherwise return 0
|
||||
* with no side effects (Req 2.3).
|
||||
*
|
||||
* This stub does NOTHING (no truncation, no restart, no once-guard set) so the
|
||||
* task 3.1 RED tests FAIL until 3.2 lands the contract above.
|
||||
*/
|
||||
int ha_rejoin_reconcile(cluster_t *c, uint64_t primary_committed_lsn)
|
||||
{
|
||||
(void)c;
|
||||
(void)primary_committed_lsn;
|
||||
return 0; /* RED scaffold — task 3.2 replaces */
|
||||
}
|
||||
|
||||
/*
|
||||
* cluster_apply_ctrlhello_reply — standby-side CtrlHelloReply intake body.
|
||||
*
|
||||
* Lives in this (unit-linkable) TU rather than cluster.c so the rejoin
|
||||
* intake-integration test can drive the real path: cluster.c (the daemon-only
|
||||
* vtask handler graph) is NOT part of controller_unit_test_src, but
|
||||
* ha_convergence.c is. cluster.c's myreq_handler calls this on every
|
||||
* CtrlHelloReply; the function stores the primary-reported committed boundary +
|
||||
* config tag (existing behavior), then is the rejoin trigger point.
|
||||
*
|
||||
* TASK 3.2 ADDS the ha_rejoin_reconcile(c, committed_lsn) call AFTER the store
|
||||
* below (design "Rejoin Reconciliation (ha.c + cluster.c intake)", research D5).
|
||||
* Task 3.1 ships only the extracted store, so the intake-integration RED test —
|
||||
* which asserts a restart fired — FAILS until 3.2 wires the trigger.
|
||||
*/
|
||||
void cluster_apply_ctrlhello_reply(cluster_t *c, uint64_t committed_lsn,
|
||||
uint64_t config_tag)
|
||||
{
|
||||
atomic_store_explicit(&c->ha.last_known_committed_lsn, committed_lsn,
|
||||
memory_order_release);
|
||||
c->ha.last_known_committed_config_tag = config_tag;
|
||||
INFO("HA: CtrlHelloReply from primary: committed_lsn=%" PRIu64
|
||||
" config_tag=%" PRIu64, committed_lsn, config_tag);
|
||||
/* TASK 3.2: ha_rejoin_reconcile(c, committed_lsn); ← rejoin trigger */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue