You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Subtask]: D07 [baseline] Reuse the existing cron engine instead of a resident scheduler per SQL task #32285
Catalog ID: D07 Origin: B - Pre-existing in the 4.2 baseline and retained on main Evidence level: Duplicate cost measured; no end-to-end regression claimed
4.2 versus main: provenance
4.2 already creates a separate cron.Cron for each SQL task. Main adds lifecycle protection but retains this structure. Ordinary cron uses one engine for multiple entries, and per-entry CRON_TZ already expresses timezone differences.
Design problem, impact, and existing responsibility
The HAKeeper leader's taskService maintains parallel discovery/scheduling infrastructure: SQL tasks reload every enabled definition every three seconds, and each job owns a scheduling goroutine plus stop/join handling. Definer and gate semantics do not by themselves establish the need for independent engines.
Acceptance criteria
Idle scheduling goroutines no longer grow by one per SQL task; retain necessary O(N) task definitions.
Preserve timezone, catch-up, update/suspend/delete, leader-change, shutdown, and durable trigger behavior without duplication.
Measure startup/idle CPU and memory at representative cardinality. Use minimal tasks for functional regressions rather than adding a 1,000-job UT fixture.
Describe implementation you've considered
Reuse existing cron/entry ownership while retaining SQL-task durable triggers, gates, definers, and overlap behavior. Measure full-definition polling at representative scale. Do not introduce a third scheduler framework.
Additional information
Existing investigation and validation limits
The production addCronTask/addSQLTask paths receive 1,000 non-immediate jobs using UTC and Asia/Shanghai. Scheduling goroutine increments are about 1 and 1,000. Local live-heap deltas are approximately 0.96-1.38MB and 2.94-3.03MB; these exclude some stack/RSS and SQL definitions and are not total-memory or end-to-end measurements.
The named probes are local diagnostic overlays, not committed repository tests. Their names identify the investigation; they cannot be selected directly from an ordinary checkout. Implement the smallest maintained contract regressions and reuse relevant CI/validation proportionally. Temporary evidence commits are not required.
changed the title [-][Subtask]: D07 [base] 复用现有 cron 引擎,消除 SQL task 每任务一个常驻调度器[/-][+][Subtask]: D07 [baseline] Reuse the existing cron engine instead of a resident scheduler per SQL task[/+]on Nov 5, 2026
Activity
[-][Subtask]: D07 [base] 复用现有 cron 引擎,消除 SQL task 每任务一个常驻调度器[/-][+][Subtask]: D07 [baseline] Reuse the existing cron engine instead of a resident scheduler per SQL task[/+]