Repository navigation
Conversation
ClickHouse#131011 resolves the substreams `addStreams` enumerates once per reader, but the substreams only the prefix lists (dynamic paths of `JSON`, variants of `Dynamic`) missed its map, so the `readData` callbacks of every block recomputed their file name (`getStreamNameForColumn`: name building, escaping, checksums lookup) and their `avg_value_size_hints` slot. `readData`'s callbacks now add such a path to the column's `ResolvedSubstreams` on first use (`resolveAndAddSubstream`, which reuses `resolveSubstream` and `avgValueSizeHintSlot`), so later blocks find it. No synchronization is needed: the callbacks of `readData` run on the reading thread, after `deserializePrefix` returned, and the only thread pool in the serializations (the prefixes pool of `SerializationObject`) is drained inside `deserializeBinaryBulkStatePrefix`. The prefix and prefetch callbacks, which can run on that pool, keep only looking paths up. Readers prefetched on the prefetch pool are handed to the reading thread through `waitForAllToFinishAndRethrowFirstError`. Taking the hint slot through `avgValueSizeHintSlot` keeps this call site coupled at compile time to its signature, which ClickHouse#132369 changes. Related: ClickHouse#124792 Related: ClickHouse#131011 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review of the diff.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261119-043700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261119-002200 |
|
Workflow [PR], commit [09fd123] Summary: ❌
AI ReviewSummaryReviewed #132877 at Final Verdict✅ Approve |
CI finish ledger - 09fd123Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261119-080025 |
Related: #124792
Related: #131011
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reading
JSONandDynamiccolumns fromWideparts is faster: the streams of their dynamic paths and types are resolved once per reader instead of for every block. For example, reading 32 dynamic paths of aJSONcolumn takes about 11% less time.Description
#131011 resolves the substreams that
addStreamsenumerates once per reader, but the substreams only the prefix of a column lists (dynamic paths ofJSON, variants ofDynamic) are unknown inaddStreams. For every block, thereadDatacallbacks of each of them rebuilt the stream name (getStreamNameForColumn) and looked up itsavg_value_size_hintsslot again. #131011 left this as a follow-up because the prefix is deserialized by several threads.readDatanow adds such a substream to the column'sResolvedSubstreamson first use (resolveAndAddSubstream, reusingresolveSubstreamandavgValueSizeHintSlot). No lock is needed: these callbacks run on the reading thread afterdeserializePrefixhas returned, and the prefixes pool is drained inside it. The prefix callbacks, which can run on that pool, and the prefetch callbacks still only look paths up.Validation: local Release builds, both servers pinned to one NUMA node, 40 paired runs measured in both orientations, ratios PR / master:
json_subcolumns_required_conversionsq0SELECT jsonof that table (400 paths)wide_part_many_substreamsq0 / q1 / q2json_shared_data_wideq0 / q1 / q2,max_threads = 1Peak memory is unchanged. A TSan build ran 180 reads, 6 at a time, of a 200-path
JSON+Dynamictable with the prefixes pool active (PrefixReaderthreads in everySELECT json) and 43 JSON/Dynamic Wide-part tests, with no report. None of the 1057 json/dynamic/variant stateless tests fails only with this change.The finding and the original patch are from @ snelheidai in #124792 (comment).
Workflow [PR]
Sync PR [sync-upstream/pr/132877]