Repository navigation
Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data - #113742
Conversation
…annot absorb finalized data The custom-key parallel replicas branch of the planner replaces the plan of a table expression with a remote read at the fixed stage `WithMergeableStateAfterAggregationAndLimit`, ignoring the stage the plan was requested up to. A `Merge` table over a `Distributed` child plans all of its children up to `WithMergeableState` through an interpreter, so a MergeTree child's plan produced finalized (post-aggregation, post-LIMIT) data where the parent `ReadFromMerge` expected partial aggregation states: `CANNOT_CONVERT_TYPE` for `count`, and the exception `Chunk should have AggregatedChunkInfo/ChunkInfoWithAllocatedBytes in GroupingAggregatedTransform` when the finalized type structurally coincides with the state type. Allow the custom-key read only when the requested stage is `Complete` or `WithMergeableStateAfterAggregationAndLimit` itself. Found by the targeted AST fuzzer on #110972 (an unrelated PR): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110972&sha=ac0a584ce316ace31f4dbc16b38e1262a2344751&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%2C%20old_compatibility%29 Closes: #113741 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [ea4a1f8] Summary: ✅
AI ReviewSummaryThis PR narrows the analyzer-side Final Verdict✅ No actionable review findings. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 8/8 (100.00%) · Uncovered code |
Build profile diff (arm_release)No arm_release build profile data for commit ea4a1f8 - the build was skipped, reused from cache, or predates profile upload. |
|
🕵 Status update:
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113742&sha=f7d93499dfda46c29fed32cb0d05236fdb3d8883&name_0=PR&name_1=Stress%20test%20%28amd_asan_ubsan%29 (text-index async mark loading effectively livelocking a query for ~16 minutes under sanitizers — |
|
Investigated. That hung check is not caused by your change, and it is two separate defects rather than one. I re-derived the numbers from the job log for The processlist snapshot at 02:31:45 shows
1. The 918 s of unkillable wait: my open PR #113436. The two threads are the query thread in 2. The 663 s itself is log amplification, and that half has no PR yet. The pool thread's stack top is I am opening a separate PR for the logging half and will link it in this thread. Note it is not specific to text indexes or to the filesystem cache. It is Two smaller things worth recording:
There is also a third, smaller axis in this artifact: 6851617 bytes were read to obtain a single 96-byte mark. That read amplification is the subject of my open #112644, but that PR clamps |
|
The logging half is now open as #113885. It removes the four The cost is message construction rather than sink throughput, so no log limiter removes it: Scope is deliberately narrower than the class, and I measured the boundary instead of asserting it: Same shape as #111546, which removed the equivalent per-block logging from The other two axes visible in that artifact are not in this PR, one concern per PR. The |
|
🕵 Status update:
|
|
Added the backport label in response to the bot's demand: #113741 (comment) |
…when the requested stage cannot absorb finalized data
Backport #113742 to 26.7: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
Cherry pick #113742 to 25.8: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
…when the requested stage cannot absorb finalized data
Resolve the single conflict in `src/Planner/PlannerJoinTree.cpp`. On 26.5 the `parallel_replicas_enabled_for_storage` and `allow_parallel_replicas_for_join_tree` lambdas differ from master, so git overlapped the whole block with the small hunk of #113742. Took the 26.5 side for the block and re-applied only the PR's own change: the `to_stage_supports_custom_key` gate (`Complete` or `WithMergeableStateAfterAggregationAndLimit`) on the custom-key parallel replicas `if`. Original pull-request: #113742
Cherry pick #113742 to 26.3: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
…when the requested stage cannot absorb finalized data
Cherry pick #113742 to 26.5: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
…when the requested stage cannot absorb finalized data
Backport #113742 to 26.5: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
…when the requested stage cannot absorb finalized data
Backport #113742 to 26.6: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
Backport #113742 to 26.3: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
Backport #113742 to 25.8: Skip the custom-key parallel replicas read when the requested stage cannot absorb finalized data
CTE/AN/QP: Merge with a Distributed child under custom-key parallel replicas -> exc. Effect in the production build a394e92: its upstream test(s) 04815_parallel_replicas_custom_key_merge_distributed_child fail on it and pass on official 26.8.8.8, run on isolated servers (evidence/fix_ci_20260925/upstream_repro/server_triage_PROD263_vs_UP2688.tsv). Upstream patch unchanged, with its test(s): 04815_parallel_replicas_custom_key_merge_distributed_child. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
CANNOT_CONVERT_TYPEand an exception inGroupingAggregatedTransformwhen reading aMergetable with one child being aDistributedtable under custom-key parallel replicas (parallel_replicas_mode = 'custom_key_sampling'or'custom_key_range'). Closes #113741.Documentation entry for user-facing changes
The custom-key parallel replicas branch of the planner replaces the plan of a table expression with a remote read at the fixed stage
WithMergeableStateAfterAggregationAndLimit, ignoring the stage the plan was requested up to. AMergetable over aDistributedchild plans all of its children up toWithMergeableStatethrough an interpreter, so aMergeTreechild's plan produced finalized (post-aggregation, post-LIMIT) data where the parentReadFromMergeexpected partial aggregation states:CANNOT_CONVERT_TYPEforcount, and the exceptionChunk should have AggregatedChunkInfo/ChunkInfoWithAllocatedBytes in GroupingAggregatedTransformwhen the finalized type structurally coincides with the state type. Only the analyzer path is affected.The fix allows the custom-key read only when the requested stage is
CompleteorWithMergeableStateAfterAggregationAndLimititself; a child planned to a partial stage now runs as a plain local read, as it does when parallel replicas are off.Found by the targeted AST fuzzer on #110972, where it is unrelated: the failure reproduces on master without
parallel_replicas_allow_merge_tables(verified on a binary with that PR's changes swapped out to the merge base). Fuzzer report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110972&sha=ac0a584ce316ace31f4dbc16b38e1262a2344751&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%2C%20old_compatibility%29 (STID3970-479a).Closes: #113741
Related: #110972
Version info
26.7.4.29,26.6.3.42,26.5.7.52,26.3.18.31,25.8.30.19