Repository navigation
Description
Parent Issue
Parent issue: #32278
Detail of Subtask
Catalog ID: D01
Origin: B - Pre-existing in the 4.2 baseline and retained on main
Evidence level: Reproduced behavioral defect
4.2 versus main: provenance
Both 4.2 and main consider a RUNNING record stale at StartedAt + 24h when no task timeout is configured. This predates main. A zero timeout means no overall task deadline, but recovery still revokes exclusion based on a fixed age.
Design problem, impact, and existing responsibility
The execution owner can remain alive while age-based recovery marks its run FAILED and admits B. The real internal executor applies its default 24h deadline separately to each statement, so that deadline does not bound a multi-statement task. SQLTaskExecutor and AcquireSQLTaskRun need a consistent owner for admission and release.
Acceptance criteria
- A remains exclusive after statement one takes 13h and statement two has run for 12h. Use a fake clock and phase barriers rather than waiting 25 real hours.
- Cover genuine owner termination/failure, zero and finite timeouts, and cancellation. A recovered old owner cannot overwrite its successor.
- Do not add probes, RPCs, or global per-batch scans to ordinary SQL execution.
Describe implementation you've considered
Define owner failure, cancellation acknowledgement, and readmission within the existing task/run lifecycle. If a total-duration limit is required, enforce it on execution and confirm termination before releasing exclusion. Preserve the documented zero-timeout semantics and reuse existing claim/runner ownership rather than adding another age-based scanner.
Additional information
Existing investigation and validation limits
The local TestAuditUnlimitedLiveSQLRunReapedByAge probe uses real ExecuteContext/Acquire transitions and memory task storage with releasable SQL barriers. At task age 25h, A is still in statement two while B enters. Normal execution and 100 focused race repetitions confirm the counterexample. Each statement remains below the default 24h per-statement deadline.
main investigation snapshot: pkg/taskservice/sql_task.go:75; pkg/taskservice/sql_task_executor.go:194; pkg/frontend/internal_executor.go:148
4.2 baseline snapshot: pkg/taskservice/sql_task.go:75; pkg/taskservice/sql_task_executor.go
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.
Coordination dependencies: D02, D03 (see the parent catalog). Shared work may be consolidated into one change; a separate PR per subtask is not required.
Activity
[-][Subtask]: D01 [base] 区分 SQL task 运行时长与执行 owner 失效,保持长任务排他性[/-][+][Subtask]: D01 [baseline] Separate SQL task duration from execution-owner failure detection[/+]fix(task): preserve SQL task execution ownership (#32331)