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:
Rongsong Shen 2026-09-27 05:46:09 +00:00
parent 88c4310e11
commit 7aac018c00
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
6 changed files with 72 additions and 17 deletions

View file

@ -170,6 +170,18 @@ int slowlane_init(slowlane_t *sl, int n_workers, int max_inflight)
return 0;
}
int slowlane_is_started(slowlane_t *sl)
{
int started;
if (sl == NULL)
return 0;
pthread_mutex_lock(&sl->lock);
started = (sl->started > 0) && !sl->stopping;
pthread_mutex_unlock(&sl->lock);
return started;
}
int slowlane_submit(slowlane_t *sl, uint64_t key, slowlane_fn_t fn, void *arg)
{
if (sl == NULL || fn == NULL)