Repository navigation
Cherry pick #125901 to 26.9: Start executor threads for CPU slots granted after the request - #129527
Merged
robot-clickhouse-ci-2 merged 20 commits intoNov 8, 2026
Merged
Conversation
A thread requested by `ExecutorTasks::pushTasks` was dropped if no CPU slot was granted at that moment, so a slot granted later stayed unused until the pipeline pushed new tasks again. `ExecutorTasks` now keeps such requests in `threads_to_spawn`, and every thread starts threads for granted slots after each task while it is non-zero. Remove `spawn_mutex` with the `pending_demand` spin loop: spawning is safe from any thread, and `desired_threads` is an atomic that only grows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the slots are released, every step waits until all threads are in it, instead of counting steps until they all ran one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A thread stops when its preempted CPU lease is not granted back in time. It was started again only when new tasks were pushed; now `ExecutorTasks::downscale` adds a requested thread, so it starts as soon as the slot is granted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test is taken from #129072 by Melvyn Peignon. Co-Authored-By: Melvyn Peignon <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The signature of `init` differs on release branches, so this keeps backports free of conflicts in `ExecutorTasks`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wait for the released slots to be acquired instead of checking how long the query takes, bound every wait, and kill both queries on any failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`ExecutorTasks::downscale` keeps its meaning; `executeStepImpl` requests the thread where it stops. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A workload limits the query to fewer CPU slots than threads, so every thread checks for granted slots after each step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pawn-without-mutex
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A thread waits for a task only when the queues are empty, so no queued task is left for the requested threads. `upscale` drops them only when the pipeline width is reached. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pushTasks` raises the `setMax` target itself after releasing its mutex and returns nothing, so the executor only starts threads for granted slots. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The target is raised under `ExecutorTasks::mutex`; `setMax` is called with the latest target under a separate mutex, since the allocation calls `resume` under its own lock. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
An idle thread drops the requested threads only if no asynchronous task is pending either: the tasks that become ready later need the threads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…thout-mutex Start executor threads for CPU slots granted after the request
Contributor
|
Dear @serxa, @Michicosun, this cherry-pick PR has not been updated for 3d0h5m48s. Please resolve the conflicts to backport #125901, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity. |
Resolve conflicts for 26.9: no `SCOPE_EXIT` in `finalizeExecution`, `ExecutionStatus` instead of `CancelReason`, keep `yield` on downscale. Adapt the gtest to the 26.9 executor (no `Runtime::V1` namespace, `ExecutorTasks::init` signature). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #125901
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job