Repository navigation
Conversation
|
Workflow [PR], commit [4cd189b] Summary: ❌
AI ReviewSummaryThe PR shares CPU allocation with the pipeline executor and makes parallel index analysis acquire CPU slots from Findings❌ Blockers
Missing context / blind spots
Tests
Final VerdictStatus: ❌ Block Fix cancellation and spawn-loop termination, add focused workload regression coverage, and provide evidence for the claimed performance improvement. |
fc96044 to
e060468
Compare
Threads of `max_threads_for_indexes` now take CPU slots from `ConcurrencyControl` or the workload scheduler, like the pipeline executor (`allocateCPUSlots`, moved out of `PipelineExecutor`).
e060468 to
4cd189b
Compare
| stopped.store(true, std::memory_order_relaxed); | ||
|
|
||
| /// May wait while the thread is preempted. Only a worker thread is downscaled, the master thread waits for a grant. | ||
| if (lease && !lease->renew()) |
There was a problem hiding this comment.
[Blocker] Make CPU lease waits cancellable during index analysis
With workload CPU scheduling, this can enter CPULeaseAllocation::waitForGrant, which waits indefinitely for slot 0. This local allocation is never connected to query cancellation, and nothing calls its free while the master is blocked. QueryStatus::cancelQuery only cancels registered executors; the analysis also runs during planning, before its pipeline executor exists.
For example, with a CPU resource covering MASTER THREAD and WORKER THREAD, max_concurrent_threads = 1, and a continuously busy higher-priority workload, a lower-priority multi-part analysis can exhaust its borrowed quantum and wait here indefinitely. KILL QUERY ... SYNC then cannot complete until the competing workload releases the CPU: setting the query's cancellation flag does not wake this wait. The existing pipeline path explicitly frees its allocation through ExecutorTasks::finish.
Connect this allocation's waits to query cancellation and abort handling, and add coverage for cancelling an analysis while its master lease is preempted.
|
|
||
| auto start_threads = [&] | ||
| { | ||
| while (auto granted_slot = cpu_slots->tryAcquire()) |
There was a problem hiding this comment.
[Blocker] Stop spawning when no index work remains
CPULeaseAllocation::release returns a released slot to the same allocation through downscale, so tryAcquire can return that slot again. If a worker finishes before the master resumes this loop, the master schedules another worker, which immediately exits after finding no parts (or stopped == true) and returns the slot again. This loop checks neither remaining parts nor stopped, so that cycle can continue indefinitely after the analysis has finished. The master also never reaches its next cancellation check or lease renewal while spinning here.
A standalone scheduling model using this exact helper, with workers completing before the scheduling caller resumes, exceeded 1000 scheduled jobs after processing just two parts; returning false from the first part produced the same loop. One-shot grants completed with one scheduled job.
Bound spawning by unclaimed parts and the stop condition as well as available slots, and cover reusable workload leases with finite work and early termination.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes5 object files changed (+62.78 KiB total), 1 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units10 translation units recompiled, 25 s compile time in total, 9 of them have a recent master baseline. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Use CPU slots for index analysis threads
Threads of
max_threads_for_indexesnow take CPU slots fromConcurrencyControlor the workload scheduler, like the pipeline executor (allocateCPUSlots, moved out ofPipelineExecutor).Workflow [PR]
Sync PR [sync-upstream/pr/133869]