Repository navigation
Apply -WithMemoryTracking containers to src/Processors/Formats - #126530
Conversation
Replace `std::` containers in `src/Processors/Formats` with their `-WithMemoryTracking` counterparts and enable the lint for the directory. Types are propagated to their owners (`src/Formats`, `Storages`), so no copies are introduced at the boundaries. Containers passed to Arrow, ORC, Avro, Parquet or Protobuf APIs, and the `Names`/`Strings`/`DataTypes` aliases stay as they are. Vectors of chunks use the `Chunks` alias. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
# Conflicts: # ci/jobs/scripts/check_style/check_cpp.sh # src/Processors/Formats/Impl/Parquet/PrepareForWrite.cpp # src/Processors/Formats/Impl/Parquet/Reader.cpp # src/Processors/Formats/Impl/ParquetV3BlockInputFormat.cpp # src/Server/ArrowFlight/ArrowFlightServer.cpp
-WithMemoryTracking containers in src/Processors/Formats-WithMemoryTracking containers to src/Processors/Formats
|
Workflow [PR], commit [cc0ae53] Summary: ✅
AI ReviewSummaryThe PR migrates format-processing containers and dependent APIs to memory-tracked allocators so allocations enforce memory limits. Reviewed the full diff and prior discussion against head Missing context / blind spots
Final VerdictStatus: ✅ Approve. No review changes requested; runtime validation remains subject to the pending CI jobs. |
Resolve conflicts with master's Parquet reader rewrite and the native `ORC` reader, and convert the `std::` containers master added to `src/Processors/Formats` since the previous merge (`ORC`, Parquet `FileFooter`/column chunks/read-ahead, `ParquetMetadataCache`, Vortex, `ArrowBatchRowLimit`, Avro) to their `-WithMemoryTracking` counterparts, along with the callers that receive them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes614 object files changed (+327.98 KiB total), 0 added.
719 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 units3383 translation units recompiled, 18186 s compile time in total, 3382 of them have a recent master baseline. Translation units without a recent master baseline:
Symbol sizes
|
…n a prefetch request `VortexBlockInputFormat::returnConverter` grows `converters`, which now throws on the memory limit; calling it from `SCOPE_EXIT` would terminate. Return the converter on success only. `Prefetcher::registerRange` now creates the `PrefetchHandle` before growing the range vector, so a throw cancels the request instead of tripping the destructor's assertion. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
Only built with `USE_DELTA_KERNEL_RS`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126530&sha=latest&name_0=PR #126530 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
Rejects every allocation of one `registerRange` call after 0 to 63 successful ones, so some calls fail while growing the range vector after the request is inserted. Without the `PrefetchHandle` created before the growth, the destructor of `Prefetcher` finds a request that is not cancelled: with that check made fatal in a release build the test aborts, with the fix it passes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
…metadata The column chunk offsets are tracked containers now, so the parsing can throw `MEMORY_LIMIT_EXCEEDED`, which `parseThrift` turned into `STD_EXCEPTION`. Rethrow `DB::Exception` as is. Without the fix the new test gets 1001. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
…llback The GeoParquet metadata parse, the row-group statistics and the column index of `covering.bbox` columns fall back to no spatial pruning on malformed input. Their containers now throw `MEMORY_LIMIT_EXCEEDED`, which was treated as malformed input: the query succeeded with pruning silently disabled. Rethrow it instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
Resolve conflicts with the new `RelativePathWithMetadata` and `ContextPtr` parameters of `IBucketSplitter::splitToBuckets` by keeping the tracked return type, and adapt the new `TestFileBucketInfo` override in `gtest_rendezvous_hashing.cpp` to the tracked `filterByMatchingRowGroups` parameter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
azat
left a comment
There was a problem hiding this comment.
Mostly OK, I've left a few comments will be nice to address some that are more important before merging
Also maybe we can add few typedes (but it is up to you):
- for ORC positions
- for column mapping, i.e. set<String, UInt64> and back
- Parquet row groups and column indexes
`Footer::parse` came from master with a `std::vector`, which the container lint of `src/Processors` rejects. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
- `ColumnMapping::insertDefaultsForNotSeenColumns` takes `std::span<UInt8>`, and `JSONCompactEachRowRowOutputFormat::writeLine` and `JSONUtils::makeNamesValidJSONStrings` take `std::span<const String>`, like the other `writeLine` overloads. - Remove the `<vector>`, `<unordered_map>` etc. includes whose last use this PR converted, the `-WithMemoryTracking` includes that have no user, and the ones a `.cpp` already gets from its own header. - Move the `-WithMemoryTracking` includes of files guarded by `USE_...` inside the guard. - Add aliases for the repeated types: `ORC::RowGroupPositions`, `ColumnNameToFieldId`, `FieldIdToColumnName` and `ColumnNameMap` (in the new `Formats/ColumnNameMaps.h`), `RowGroupIndices`, `Parquet::ColumnIndices` and `Parquet::ColumnChunkOffsets`. #126530 (review) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
# Conflicts: # src/Processors/Formats/Impl/Parquet/Reader.cpp
Conflicts in the includes of `AvroRowInputFormat.cpp` and `VariantEncoding.cpp` and in `SchemaProcessor.h`: kept master's code without the includes that are no longer used, and `ColumnNameToFieldId` for `traverseSchema`. Also used `VectorWithMemoryTracking` for the new `stripe_first_rows` in the ORC reader. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
…-parallel-read Conflicts were caused by #126530, which moved Parquet reading and `IInputFormat` to `VectorWithMemoryTracking` and related aliases (`ColumnIndices`, `RowGroupIndices`, `UnorderedSetWithMemoryTracking`). Kept the PR's code (`splitForParallelReading`, `SharedFileColumnChunks`, `collectSortedMetadataOffsets`) and converted its containers to the new types, also in `ReadManager.cpp` and `StorageFile`.
…allelReading` The style check requires memory-tracked containers in `src/Processors/Formats` after #126530. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125738&sha=5c39d798dc5dd33ad921946788e5ecc121ccbb8f&name_0=PR&name_1=Style%20check PR: #125738 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…p-k-string-decode-bound Resolve conflicts with ClickHouse#129882 and ClickHouse#126530: `optimize` takes both `top_k_filter_column` and `top_k_string_sort_column`, the step predicates keep both conditions, and `get_columns_written_to_cache` returns master's `VectorWithMemoryTracking<bool>`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cache The style check now requires the `-WithMemoryTracking` containers in `src/Processors/Formats` (ClickHouse#126530). The row block bitmaps passed through `IInputFormat::getMatchedRowBlocks` / `setRowBlocksToRead` become `VectorWithMemoryTracking<bool>`, and `QueryConditionCache::readFile` converts the stored marks to it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The conflicts come from the `-WithMemoryTracking` containers of #126530, which 26.10 does not have: the new code uses std::unordered_set and std::vector, like the rest of the file on 26.10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The conflicts come from the `-WithMemoryTracking` containers of #126530, which 26.9 does not have: the new code uses std::unordered_set and std::vector, like the rest of the file on 26.9. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The conflicts come from the `-WithMemoryTracking` containers of #126530 and from `findORCStructFieldByName` of #109741, which 26.8 does not have: the new code uses std::unordered_set and std::vector, and the recursive call keeps the name lookup of 26.8. The test enables `enable_nullable_tuple_type`, which is off by default on 26.8, and drops the five queries that read a subcolumn through a list (`tb.l.b`, `an.x.v`): 26.8 returns empty arrays for such a path even for a field that is in the file, with or without this change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The conflicts come from the `-WithMemoryTracking` containers of #126530, which 26.3 does not have, and from `unwrapORCNullableTuple`, which 26.3 still has next to the new function: the new code uses std::unordered_set and std::vector, and both functions are kept. The test enables `allow_experimental_nullable_tuple_type`, which is off by default on 26.3, and drops seven queries that fail on 26.3 with or without this change: the five that read a subcolumn through a list (`tb.l.b`, `an.x.v`, which 26.3 returns as empty arrays even for a field that is in the file), and the two that read a field of the NULL struct `ts` that is in the file as a non-Nullable element of a Nullable Tuple (by name and by position), which 26.3 rejects with CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN, also when every field is requested. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The style check now requires `src/Processors/Formats` to use the `-WithMemoryTracking` aliases instead of standard containers (#126530). CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=111932&sha=latest&name_0=PR&name_1=Style%20check PR: #111932 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two semantic conflicts with master made the merge-queue run fail (MergeQueueCI run 43079186130, merge commit 9948f7e): - ClickHouse#129121 added a call to `reinterpretRawByteColumns` for native GeoArrow columns, while this branch gave that function a `repair_variants` parameter. Pass `true`, as the other materialized column call in `buildChunk` does; the geo target type has no `Variant`, so the value does not change the result. - ClickHouse#126530 extended the `-WithMemoryTracking` container style rule to `src/Processors/Formats`; use `VectorWithMemoryTracking` in `variantElementTargets`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master now enforces clang-tidy `modernize-use-nodiscard` (ClickHouse#126158), so the `canRejectValues` overrides get `[[nodiscard]]` like the neighbouring `isTrivial` overrides, and bans plain `std::vector` in `src/Processors/Formats` (ClickHouse#126530), so the decode ranges use `VectorWithMemoryTracking`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/126530]
Version info
26.11.1.1727-master(included in26.11and later)