fix(controller): offload demotion convergence and catch-up streaming by default (bug-1450, bug-1451)
f88e4ef4 moved ha_demotion_convergence_fn's WAL truncate + self-restart
and ha_catchup_continuation_fn's WAL streaming off the delaymgr thread
(which drives heartbeats and election timeouts cluster-wide) onto the
slow lane, but left both flags OFF: flipping them ON hung pre-existing
unit fixtures that demote a primary or trigger catch-up without ever
starting c->slowlane -- the work was queued in a lane with no workers and
never ran.
- slowlane_is_started(): true while the lane has live workers.
- Both dispatchers run inline when the flag is OFF *or* the lane was never
started. Production always starts the lane, so it always offloads; the
lightweight fixtures keep their old inline behaviour, and neither
one-shot action can be silently dropped.
- g_drive_async_demotion_offload / g_drive_async_catchup_offload now
default to 1. The offload tests save and restore the previous value
instead of forcing 0.
New test_catchup_offload_without_started_lane_runs_inline (RED before: the
catch-up body never ran, the stream gate was never reached). Controller
suite 1239/0 with both offloads ON by default.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
88c4310e11
commit
7aac018c00
6 changed files with 72 additions and 17 deletions
|
|
@ -2851,8 +2851,13 @@ typedef struct {
|
|||
* same kind of follow-up audit, out of scope for this fix (bug-1451,
|
||||
* buglog.json). Compiled in ALL builds; the setter is the test seam to
|
||||
* flip RED<->GREEN.
|
||||
*
|
||||
* bug-1451 follow-up (2026-09-27): now ON by default. The fixture hang above
|
||||
* is avoided by running inline whenever the slow lane was never started
|
||||
* (slowlane_is_started), which is exactly those lightweight fixtures;
|
||||
* production always starts the lane.
|
||||
*/
|
||||
static _Atomic int g_drive_async_catchup_offload = 0;
|
||||
static _Atomic int g_drive_async_catchup_offload = 1;
|
||||
|
||||
void ha_set_catchup_offload_for_test(int on)
|
||||
{
|
||||
|
|
@ -2951,10 +2956,12 @@ int ha_catchup_continuation_fn(void *arg)
|
|||
cluster_t *c = ctx->c;
|
||||
int peer_idx = ctx->peer_idx;
|
||||
|
||||
if (!ha_catchup_offload_enabled()) {
|
||||
/* Legacy inline path (flag OFF) — blocks the calling (delaymgr)
|
||||
* thread. Retained solely so the RED test can show the pre-change
|
||||
* stall; production runs with the flag ON. */
|
||||
if (!ha_catchup_offload_enabled() || !slowlane_is_started(&c->slowlane)) {
|
||||
/* Inline path -- blocks the calling (delaymgr) thread. Taken with
|
||||
* the flag OFF (kept so the RED test can show the pre-change stall)
|
||||
* or when the slow lane was never started (lightweight fixtures):
|
||||
* work submitted there would never run and the standby would never
|
||||
* be caught up (bug-1451). */
|
||||
catchup_lane_fn(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue