Repository navigation
Use one source instead of N for parallel_inserts of AzureQueue/S3Queue (re-land #130864 with a fix) - #131689
Conversation
After #130864, `parallel_inserts=1` runs one streaming task per processing thread. Every successful commit, including commits of empty batches by idle tasks, reset the shared `max_files_override` to 0, undoing the halving done by the task that hit a failing INSERT. The bad file then never ended up alone in a batch, its retry count was never reduced, and good files batched together with it were never processed. Reset the override only after a batch which committed files, and only if no other task changed it since this iteration started. Failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=83b6da0324076eb3a1c8f1ea58fee8c57e24e757&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%204%2F4%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [808b84c] Summary: ✅
AI ReviewSummaryRestores the intended source count for Missing context / blind spots
Findings
Final VerdictStatus: Minimum required action: include the task-recreation fix from #130904 in the same rollout so supported |
…ue/S3Queue" This reverts commit c778410.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units1423 translation units recompiled, 224 s compile time in total, 1423 of them have a recent master baseline. |
Runs the play.clickhouse.com "Failed checks" query (or decodes the query from a play link), groups failures into kinds, classifies them with history (first bad commit, release branches, flakiness onset), investigates the unexplained ones with subagents, searches for existing issues and PRs, and opens one PR per new fix. Written from the 2026-11-14 triage, which produced ClickHouse#131689. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A numeric compare-exchange could not tell that a failure happened after a batch started if the halved limit came back to the same value, so an older successful batch could clear a newer reduction. Move the shared limit into `ObjectStorageQueueBatchSizeOverride`, which pairs it with a generation that every failure increments; a success resets the limit only if the generation is unchanged since its batch started. Review: #131689 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
With `parallel_inserts` there is one streaming task per processing thread, but they shared one `reschedule_processing_interval_ms`. Every task that found no files added `polling_backoff_ms` to it, so N idle tasks grew the backoff N times faster (e.g. 4 tasks reached 121 s after one idle poll), and a reset by the task which found files did not shorten the wait of the others, which were already scheduled far out. New files then waited for minutes. Keep the interval per task, as it was with the single task. Found from `05618_s3queue_alter_parallel_inserts` timing out in #130904: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=130904&sha=c8b5134c4293785f35c7ed755b32af690c093a0b&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20targeted%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
With one source per streaming task, a task can get no files while the shared iterator is not finished, e.g. in ordered mode when the remaining cached paths belong to buckets held by other tasks. It then committed empty batches and rebuilt the insert pipeline in a loop, never reaching its polling backoff. End the cycle instead. Review: #131689 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ndependently of commit limits With `parallel_inserts` each streaming task has its own processor and commits independently, but `FileIterator::releaseFinishedBuckets` released the finished bucket holders of all processors. A holder is finished when its source reaches the end, before the insert of that source completes, so a commit of one task could release the bucket lock of another task whose insert was still running, letting another replica take the bucket and process later files before the first insert failed. Now `releaseFinishedBuckets` takes the processors of the batch which has just been committed. `ProcessingProgress::processed_files` is counted only when `max_processed_files_before_commit` is set, so with that limit disabled and a row or byte limit enabled, a batch which processed files looked empty: the consumption cycle ended after every batch and the backlog was drained one batch per poll. Now a separate `acquired_files` counter, maintained regardless of the commit limits, is used to detect empty batches, to guard the reset of the batch size override, and as the size of a failed batch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ClickHouse#131689 ends the streaming cycle when a task acquired no files, so the loop exit this PR added is gone from it after the master merge, and arm D covered only that. The test is back to the version of 085ac51. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #130864
Related: #131691
Related: #98810
Related: #130904
Re-lands #130864 (reverted in #131691) together with a fix for the regression it exposed.
#130864: with
parallel_inserts=1, the setting was never serialized into table metadata but was read from it to decide the parallelism of SELECTs, so it had no effect. Now it is not read from metadata, and each streaming task uses one source.The fix: with one streaming task per processing thread, all tasks share
max_files_override. When an INSERT fails (e.g. aCHECKconstraint), the failing task halves the override so the bad file eventually lands alone in a batch and its retry count is reduced. But every successful commit reset the override to 0, including empty commits by idle tasks ("Successfully committed 0 files"), so the halving never took effect: the same batch (test_22.csv,test_999.csv,test_9999.csv) was retried forever without reducing retries, and the good file in it was never processed. Now the override is reset only after a batch which committed files, and only via compare-exchange from the value this iteration started with, so a task can't undo a halving made by another task meanwhile.Also, the polling backoff is now kept per streaming task. All tasks shared
reschedule_processing_interval_ms, so with N tasks every idle poll of each task addedpolling_backoff_ms(e.g. 4 tasks waited 121 s after one idle poll), and a reset by the task which found files did not shorten the waits of the others. Found from05618_s3queue_alter_parallel_insertstiming out in #130904.Also, with one processor per task, a task releases only the bucket locks of its own processors after its commit. Before, it released the finished locks of all processors, so in ordered mode it could release a bucket whose insert in another task was still running. And empty batches are now detected with a counter of acquired files that is kept regardless of the commit limits. Before, with
max_processed_files_before_commit = 0and a row or byte limit set, every batch looked empty, so the backlog was drained one batch per poll.This fixes
test_storage_s3_queue/test_parallel_inserts.py::test_parallel_inserts_with_failures[1-exclusive](5 failures out of 532 runs after #130864, 0 before): https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=83b6da0324076eb3a1c8f1ea58fee8c57e24e757&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%204%2F4%29Follow-up: #130904 recreates the streaming tasks when
processing_threads_numis changed withALTER(with one source per task, the number of tasks is otherwise fixed at table creation).Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
parallel_insertsofS3Queue/AzureQueue: the setting had no effect on the parallelism of reading, because it was read from table metadata where it was never stored.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131689]
Version info
26.11.1.2822-master(included in26.11and later)