Repository navigation
Apply *WithMemoryTracking containers to BridgeHelper and some Core subdirectories - #106047
Conversation
`src/BridgeHelper` had only three raw `std::vector<std::pair<...>>` spellings, all in `XDBCBridgeHelper.h` and all the same type. Lift the existing nested `URLParams` alias to namespace scope so the pure-virtual on `IXDBCBridgeHelper`, the override, and the local result all share the alias. The alias itself is marked with `STYLE_CHECK_ALLOW_STD_CONTAINERS` since callers (and the underlying HTTP transport) expect `std::vector<std::pair<...>>`. Add `src/BridgeHelper` to the list of linted directories. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In `src/Core/`, switch six aliases whose conversion has no caller
ripple to their WithMemoryTracking equivalents:
- `NamesWithAliases` (`Names.h`) — 0 raw spellings outside the
definition; was a plain `std::vector<NameWithAlias>`.
- `Block::IndexByName` (`Block.h`) — private; the three external
callers use `auto` over the alias, so the underlying-type change
is transparent.
- `BlocksList` (`Block_fwd.h`) — 0 raw spellings outside the
definition.
- `SharedHeaders` (`Block_fwd.h`) — 0 raw spellings outside the
definition.
- `FieldVector` and `FieldMap` (`Field.h`) — already used
`AllocatorWithMemoryTracking` in the body; spell them via the
`VectorWithMemoryTracking` / `MapWithMemoryTracking` aliases
instead, which is semantically identical but no longer trips a
raw `std::vector<` / `std::map<` spelling.
Other aliases in these headers (`Names`, `Strings`, `DataTypes`,
`Columns`, `Blocks`, `Serializations`, `Row`, `SortDescription`,
`NamesAndTypesList`, etc.) are deferred — each has hundreds of raw
spellings or non-trivial inheritance ripple that requires a wider
campaign.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Change `Blocks` in `Core/Block_fwd.h` from `std::vector<Block>` to
`VectorWithMemoryTracking<Block>`. Delete the redundant duplicate
definition in `Interpreters/InterpreterSelectWithUnionQuery.h`
(that header already includes `Core/Block_fwd.h`).
Update the seven remaining raw `std::vector<Block>` spellings to use
the alias:
- `Core/Block.{h,cpp}` `concatenateBlocks` parameter.
- `Storages/MergeTree/PatchParts/applyPatches.{h,cpp}` (one field
and two locals).
- `Interpreters/InsertDependenciesBuilder.cpp` (two ctor/method
parameters and one local).
Also add an `#include <Core/Block_fwd.h>` to `Core/Block.h` so the
`Blocks` alias is visible at the `concatenateBlocks` declaration.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The `Serializations = std::vector<SerializationPtr>` alias was redeclared in four headers: - `Core/Block.h` - `DataTypes/Serializations/ISerialization.h` - `Processors/Formats/IRowOutputFormat.h` - `Processors/Formats/Impl/TemplateBlockOutputFormat.h` Switch all four bodies to `VectorWithMemoryTracking<SerializationPtr>` in lock-step so the redeclarations agree. Also convert the `VariantSerializations` private alias in `DataTypes/Serializations/SerializationVariant.h`, which is the same underlying type. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The `DataTypes = std::vector<DataTypePtr>` alias was redeclared in
ten headers across `Core/`, `DataTypes/`, `AggregateFunctions/`,
`Formats/`, and `Processors/Formats/`. Switch all ten bodies to
`VectorWithMemoryTracking<DataTypePtr>` in lock-step so the
redeclarations agree, and add `Common/VectorWithMemoryTracking.h`
includes where needed.
Also convert the related `DataTypesWithConstInfo` typedef in
`DataTypes/IDataType_fwd.h` and update the raw `std::vector<DataTypePtr>`
spellings at the remaining call sites to use the alias:
- `Storages/RocksDB/StorageEmbeddedRocksDB.cpp` (local).
- `Storages/ObjectStorage/DataLakes/Iceberg/` (`ChunkPartitioner.h`
field+getter, `IcebergWrites.{h,cpp}` parameter, `Mutations.cpp`
fallback, plus `SchemaProcessor.cpp` deduction-style call).
- `DataTypes/DataTypeCustomGeo.cpp` deduction-style call.
- `Compression/tests/gtest_compressionCodec.cpp` four locals.
- `Processors/tests/gtest_write_parquet_page_index.cpp` parameter.
- `DataTypes/tests/gtest_yt_schema.cpp` local.
- `Databases/DataLake/Common.cpp` local (was spelled with the
`DB::DataTypePtr` namespace prefix).
Drop the two `STYLE_CHECK_ALLOW_STD_CONTAINERS` markers on the
`DataTypes` definitions in `AggregateFunctions/`, which are no
longer needed after the body switches to the WMT alias.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In `Columns/IColumn_fwd.h`, switch the three column aliases (`Columns`, `MutableColumns`, `ColumnRawPtrs`) from `std::vector<...>` to `VectorWithMemoryTracking<...>` and drop the three `STYLE_CHECK_ALLOW_STD_CONTAINERS` markers. The header already includes `Common/VectorWithMemoryTracking.h` (the existing `EqualRanges` and `ColumnCheckpoints` aliases already use it). Convert two redeclarations of the same aliases: - `Interpreters/inplaceBlockConversions.h` (`Columns`). - `Interpreters/JoinUtils.h` (`ColumnRawPtrs`). Convert the related `PrimaryIndex = std::vector<ColumnPtr>` alias in `Storages/MergeTree/PrimaryIndexCache.h` for consistency. Update all raw `std::vector<ColumnPtr>` / `std::vector<MutableColumnPtr>` / `std::vector<const IColumn *>` spellings throughout the tree to use the aliases (about thirty call sites across `Storages/`, `DataTypes/Serializations/`, `Interpreters/`, `Processors/`, `Formats/`, `Server/`, and tests). Also includes `Interpreters/Squashing.cpp` which spelled the type as `std::vector<IColumn::MutablePtr>`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In `Core/SortCursor.h`, switch four `std::vector<...>` aliases / fields to their `VectorWithMemoryTracking<...>` equivalents: `NeedCollationFlags`, `raw_sort_columns_data`, `SortCursorImpls`, and the private `Container` of the `SortingQueueImpl`. In `Core/InterpolateDescription.h`, switch the three internal struct fields to their WMT equivalents (`UnorderedMapWithMemoryTracking`/`UnorderedSetWithMemoryTracking`/ `VectorWithMemoryTracking`). The public `Aliases` alias is left unchanged because it has wide caller spelling (`std::unordered_map<String, ASTPtr>`). In `Core/Streaming/CursorTree.cpp`, switch all six local `std::map<String, Int64>` / `std::vector<String>` instances (file- scope helper parameters and locals) to the WMT equivalents. In `Core/Block.cpp`, switch two locals to WMT (`sorted_index_by_name` and the `lcs` matrix in `getColumnsContentSampleFlat`). The public `Block::erase(const std::set<size_t> &)` is deferred since callers pass plain `std::set<size_t>`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…Map to WMT
Lock-step conversion across four related Core aliases plus their
redeclarations and call sites:
- `NamesAndTypes`: `std::vector<NameAndTypePair>` →
`VectorWithMemoryTracking<NameAndTypePair>`. Convert the
redeclaration in `Analyzer/Utils.h` to match. Fix two raw
`std::vector<NameAndTypePair>` spellings (one in
`Processors/Formats/Impl/DWARFBlockInputFormat.cpp`, one in
`Analyzer/Passes/InverseDictionaryLookupPass.cpp`).
- `NamesAndTypesList`: base class changes from
`std::list<NameAndTypePair>` to
`ListWithMemoryTracking<NameAndTypePair>`. The two
initializer-list / iterator-range constructors are updated to
delegate to the new base. No external callers spell out
`std::list<NameAndTypePair>` so this is contained.
- `NamesAndTypesLists`: `std::vector<NamesAndTypesList>` →
`VectorWithMemoryTracking<NamesAndTypesList>`. Convert the
redeclaration in `Formats/SchemaInferenceUtils.h` to match. Fix
raw `std::vector<NamesAndTypesList>` spellings in
`Storages/MergeTree/MergeTreeReadTask.h` (two fields) and
`Storages/MergeTree/MergeTreeReadPoolBase.cpp` (two parameters).
- `NamesAndTypesList::getNameToTypeMap()` return type:
`std::unordered_map<std::string, DataTypePtr>` →
`UnorderedMapWithMemoryTracking<...>`. Update its definition in
`Core/NamesAndTypes.cpp` to match, plus three downstream
`std::unordered_map<std::string, DataTypePtr>` fields/aliases
that interact with the return value: the
`hive_partition_columns_to_read_from_file_path_map` field in
`Storages/prepareReadingFromFormat.h`, the
`alias_name_to_expression_type` field in
`Analyzer/Resolve/ScopeAliases.h`, and the `UpdatedTypeMap` inner
map alias in `Analyzer/Passes/PruneArrayJoinColumnsPass.cpp`.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`Core/BackgroundSchedulePool.h` has seven internal `std::*<...>` containers, all private storage or returned by-value. Switch them to WMT equivalents: - `getTasks()` return type → `VectorWithMemoryTracking`. - `DelayedTasks` alias → `MultiMapWithMemoryTracking`. - `Threads` alias → `VectorWithMemoryTracking`. - `TasksGroup::tasks` field → `DequeWithMemoryTracking`. - `task_groups` field → `UnorderedMapWithMemoryTracking`. - `runnable_task_types` field → `VectorWithMemoryTracking`. - `running_tasks` field → `UnorderedSetWithMemoryTracking`. Update `BackgroundSchedulePool::getTasks` and its local `unique_tasks` set in `Core/BackgroundSchedulePool.cpp` to match. Both existing `getTasks()` callers use `auto`, so they need no changes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three small Core aliases with low ripple:
- `SortDescription`: change inheritance from `std::vector<SortColumnDescription>` to `VectorWithMemoryTracking<SortColumnDescription>`. The companion `SortDescriptionWithPositions` alias is also switched to `VectorWithMemoryTracking`. Only one external spelling of the underlying `std::vector<SortColumnDescription>` exists (the inheritance line itself), so no caller fixes are needed.
- `TypeIndexesSet`: `std::unordered_set<TypeIndex>` → `UnorderedSetWithMemoryTracking<TypeIndex>` in `Core/Types.h` and `Core/Types_fwd.h`. The same change is applied to the synonym `TypeIndexSet` in `DataTypes/getLeastSupertype.h`.
- `ColumnNumbersList` and `ColumnNumbersSetList`: `std::vector<ColumnNumbers>` / `std::vector<ColumnNumbersSet>` → `VectorWithMemoryTracking<...>` in `Core/ColumnNumbers.h`. The `ColumnNumbers` and `ColumnNumbersSet` aliases themselves are not touched (their underlying `std::vector<size_t>` / `std::unordered_set<size_t>` spellings are too generic and widely used). Update the one raw caller in `Interpreters/Aggregator.{h,cpp}` (`aggregates_positions` field + `calculateAggregatesPositions` return type).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In `Core/Names.h`, switch four of the eight column-name aliases to their WithMemoryTracking equivalents: - `NameMultiSet` → `MultiSetWithMemoryTracking<std::string>`. - `NameToNameSetMap` → `UnorderedMapWithMemoryTracking<std::string, NameSet>`. - `NameToNameVector` → `VectorWithMemoryTracking<std::pair<std::string, std::string>>`. - `NameToIndexMap` → `UnorderedMapWithMemoryTracking<std::string, size_t>`. All four are accessed via the alias name in callers (`NameMultiSet`, `NameToIndexMap`, etc.), so the body switch is transparent to consumers. Raw `std::multiset<std::string>` / `std::unordered_map<std::string, NameSet>` spellings exist only at the alias definition itself; the wider-spelled `std::vector<std::pair<...>>` and `std::unordered_map<std::string, size_t>` are used elsewhere with unrelated semantics and are not affected. The four still-deferred aliases (`Names`, `NameSet`, `NameOrderedSet`, `NameToNameMap`) have hundreds of raw caller spellings each and need a wider campaign. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`Core/PostgreSQLProtocol.h` had 13 raw `std::*<...>` containers used
as message fields, member fields of the protocol handler, and a
static lookup. Switch most of them to their WMT equivalents:
- `StartupMessage::parameters` → `UnorderedMapWithMemoryTracking`.
- `RowDescription::fields_descr` ref → `VectorWithMemoryTracking<FieldDescription>`.
- `DataRow::row` ref → `VectorWithMemoryTracking<std::shared_ptr<ISerializable>>`.
- `CopyOutData::data` field and ctor → `VectorWithMemoryTracking<char>`.
- `classifyQuery::query_patterns` static → `VectorWithMemoryTracking`.
- `AuthenticationManager::type_to_method` field →
`UnorderedMapWithMemoryTracking`; the ctor takes
`VectorWithMemoryTracking<std::shared_ptr<AuthenticationMethod>> &`.
- `PreparedStatementsManager::statements` field →
`UnorderedMapWithMemoryTracking`.
`BindQuery::parameters` and `PreparedStatementsManager::getStatement`'s
`arguments` parameter remain `std::vector<String>` because they are
fed from `ASTExecute::arguments` (a parser AST field that is plain
`std::vector<String>`); converting that would ripple into `Parsers/`.
Caller chain in `Server/`:
- `PostgreSQLHandlerFactory::auth_methods` field switched to
`VectorWithMemoryTracking`.
- `PostgreSQLHandler` ctor parameter `auth_methods_` switched in
both header and definition.
- `PostgreSQLHandler.cpp`: the `start_up_message.parameters`
reference is now `auto &` (transparent to the new map type),
and the `result_buf` local fed into `CopyOutData(...)` is
`VectorWithMemoryTracking<char>` (compatible with the existing
`WriteBufferFromVectorImpl<decltype(result_buf)>`).
- `Processors/Formats/Impl/PostgreSQLOutputFormat.cpp`: the two
locals fed into `RowDescription(...)` and `DataRow(...)` are
switched to `VectorWithMemoryTracking`.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Five small Core sub-trees with internal-only containers:
- `Core/MySQL/PacketsProtocolBinary.h`: `ResultSetRow::serialized` and
`null_bitmap` fields → `VectorWithMemoryTracking`.
- `Core/YTsaurus/YTsaurusClient.h`:
`ConnectionInfo::http_proxy_urls` field → `VectorWithMemoryTracking<String>`
(and `Storages/YTsaurus/StorageYTsaurus.h::YTsaurusStorageConfiguration::http_proxy_urls`
is updated to match);
`SchemaDescription::columns` field → `UnorderedMapWithMemoryTracking`
(and the local `yt_columns` in `YTsaurusClient::getTableSchema` is
aligned).
- `Core/PlainRanges.{h,cpp}`: `PlainRanges::invert` return type
`std::vector<Ranges>` → `VectorWithMemoryTracking<Ranges>`. The
only caller, in `Storages/MergeTree/KeyCondition.cpp`, switches
its local from `std::vector<Ranges>` to `auto`.
- `Core/PostgreSQL/PoolWithFailover.h`: four nested aliases
(`ReplicasConfigurationByPriority`, `RemoteDescription`,
`Replicas`, `ReplicasWithPriority`) switch to WMT. The single
external user in `Dictionaries/PostgreSQLDictionarySource.cpp`
refers via the alias and adapts automatically.
- `Core/PostgreSQL/insertPostgreSQLValue.{h,cpp}`: the
`std::unordered_map<size_t, PostgreSQLArrayInfo>` parameter
type (both `insertPostgreSQLValue` and
`preparePostgreSQLArrayInfo`) and a local `std::vector<Row>`
inside `insertPostgreSQLValue` switch to WMT. The matching
`ArrayInfo` aliases in `Storages/PostgreSQL/MaterializedPostgreSQLConsumer.{h,cpp}`,
the `array_info` field in `Processors/Sources/PostgreSQLSource.h`,
and three locals in `Core/tests/gtest_insertPostgreSQLValue.cpp`
are updated in lock-step.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three small Core aliases / fields with zero or one external raw
spelling:
- `Core/ExternalTable.h`: `BaseExternalTable::structure` field
switches from `std::vector<std::pair<std::string, std::string>>` to
`VectorWithMemoryTracking<...>`. The field is internal-only;
callers `.clear()`, `.emplace_back()`, and iterate via range-for.
- `Core/YTsaurus/YTsaurusQueries.h`: `QueryParameters` alias
`std::vector<QueryParameter>` → `VectorWithMemoryTracking`.
- `Core/ValuesWithType.h`: `ValuesWithType` alias
`std::vector<ValueWithType>` → `VectorWithMemoryTracking`.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The non-virtual `getAllRegisteredNames` / `getAllAliasNames` / `getChangedAndObsoleteNames` / `getUnchangedNames` accessors on `Settings`, `MergeTreeSettings`, `MySQLSettings`, and `YTsaurusSettings` all return `std::vector<std::string_view>` listing the registered setting/alias names. Switch all four return types and their local accumulators to `VectorWithMemoryTracking<std::string_view>`. Also convert the private `settings_changed_by_compatibility_setting` field of `SettingsImpl` in `Core/Settings.cpp` from `std::unordered_set<std::string_view>` to `UnorderedSetWithMemoryTracking<std::string_view>`. All callers use `auto` / `const auto &` / a generic lambda, so the change is transparent. Skipped: the `getAllRegisteredNames` / `getHints` virtuals from `Common/NamePrompter.h` / `Common/IFactoryWithAliases.h`. Those return `std::vector<String>` and are overridden across 15+ classes that variously use `Names`, `Strings`, or the raw spelling; the `Names` / `Strings` aliases themselves still resolve to plain `std::vector<String>` (deferred high-ripple campaign), so the virtual hierarchy is deferred too. The `disallowed_values` local in `Settings::dumpToSystemSettingsColumns` is also untouched because `Access/SettingsConstraints::get` takes `std::vector<Field> &` and converting that ripples into Access. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In `Core/Range.h`, switch both `Ranges` and `Hyperrectangle` from `std::vector<Range>` to `VectorWithMemoryTracking<Range>` (they have the same underlying type, just different semantic intent). Sweep the 17 raw `std::vector<Range>` spellings at fields, parameters, locals, and return types across `Storages/MergeTree/` (`IMergeTreeDataPart`, `MergeTreeIndexMinMax`, `MergeTreeIndexSet`), `Storages/Hive/`, `Storages/ObjectStorage/DataLakes/Iceberg/`, `Processors/QueryPlan/ReadFromSystemPrimesStep`, `Interpreters/Set`, and `Interpreters/tests/gtest_merge_tree_set_index.cpp` to use the `Ranges` alias. Add `using Ranges = VectorWithMemoryTracking<Range>;` as a forward-decl in `Interpreters/Set.h` so the `checkInRange` parameter type resolves without pulling in the full `Core/Range.h`. `Processors/Transforms/MergeJoinTransform.h` (nested `MergeJoinAlgorithm::Range`) and `Interpreters/tests/gtest_filecache.cpp` (`FileSegment::Range`) define their own unrelated `Range` types and are deliberately left untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`Core/ServerSettings.cpp` has two locals with brace-init lists used
as static lookup tables during config loading and introspection:
- `settings_from_profile_allowlist` (a per-load
`std::unordered_set<std::string>`) → `UnorderedSetWithMemoryTracking`.
- `changeable_settings` (a `std::unordered_map<String, std::pair<String, ChangeableWithoutRestart>>`
populated once in `dumpToSystemServerSettingsColumns`) →
`UnorderedMapWithMemoryTracking`.
`Core/SettingsFields.h`'s `SettingFieldMultiEnum::parseValueFromString`
local `values_set` (used to dedup parsed enum values) →
`UnorderedSetWithMemoryTracking<EnumType>`.
The public `SettingFieldMultiEnum::ValueType = std::vector<Enum>` is
not touched because `Core/tests/gtest_settings.cpp` compares
`setting.value` against literal `std::vector<MySQLDataTypesSupport>{...}`
across seven ASSERT_EQ sites — converting `ValueType` to WMT would
break those comparisons (different `operator==`).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Eight more small one-off conversions across Core, all internal-only
or alias-only with low ripple:
- `Core/Streaming/CursorTree.h`: private `Data = std::map<...>` →
`MapWithMemoryTracking`.
- `Core/SortDescription.cpp`: static `counter` map (compile-time
cache in `compileSortDescriptionIfNeeded`) → WMT.
- `Core/NamesAndAliases.h`: `NamesAndAliases` alias
`std::vector<NameAndAliasPair>` → `VectorWithMemoryTracking`
(only the def itself spells the type; callers all use the alias).
- `Core/MySQL/PacketsProtocolText.h`: `ResultSetRow::serialized`
field → `VectorWithMemoryTracking<String>`.
- `Core/MySQL/Authentication.cpp`: `plaintext` local fed by
`EVP_PKEY_decrypt` → `VectorWithMemoryTracking<unsigned char>`.
- `Core/ExternalResultDescription.h`: `types` field
`std::vector<std::pair<ValueType, bool>>` → WMT. Callers use
random access by index which works on both vector types.
- `Core/CaseAwareBlockNameMap.cpp`: `ambiguous_keys` field on
`CaseInsensitiveBlockNameMap` → `UnorderedSetWithMemoryTracking`.
- `Core/BlockMissingValues.h`: `RowsMaskByColumnId` alias
`std::vector<RowsBitMask>` → `VectorWithMemoryTracking`.
`Core/QualifiedTableName.h::getParts`, `Core/Block.h::erase(std::set)`,
and `Core/BlockInfo.h::out_of_order_buckets` are not touched —
each has callers (ASTIdentifier ctor; SettingsConstraints;
`std::vector<std::vector<Int32>>` in MergingAggregatedMemoryEfficient)
that would ripple changes into deferred areas.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… to WMT
`Common/NamePrompter.h` is the base of the `IHints<>` virtual
hierarchy used by 15+ derived classes for hint/typo-correction
infrastructure. Switch the entire surface from `std::vector<String>`
to `VectorWithMemoryTracking<String>`:
- `NamePrompter<>::getHints` and helper templates.
- Free functions `getHintsErrorMessageSuffix` and
`appendHintsMessage` (header decl and `NamePrompter.cpp` def).
- `IHints<>::getAllRegisteredNames` virtual + `IHints<>::getHints`
overloads.
Update every override in the codebase to match:
`IFactoryWithAliases`, `KnownObjectNames`,
`ClientApplicationBase::cmd_options` (plus its field type),
`SettingsImpl` and `Settings::getHints` in `Core/Settings`,
`EnumValues`, `StorageFactory`, `DatabaseFactory`, `IStorage`,
`ColumnsDescription`, `IndicesDescription`,
`ProjectionsDescription`, `UserDefinedSQLFunctionFactory` (+ its
storage `IUserDefinedSQLObjectsStorage::getAllObjectNames`),
`UserDefinedWebAssembly`, `UserDefinedExecutableFunctionFactory::getRegisteredNames`,
`FormatFactory`, `HTTPPathHints`, `TableNameHints`, and
`DatabaseCatalogImpl::DatabaseNameHints`.
`Databases/IDatabase::getAllTableNames` (used by
`TableNameHints::getAllRegisteredNames`) is converted in lock-step,
plus its `DatabaseOrdinary` override.
Update direct callers that bound the result to `std::vector<String>`:
six sites in `Interpreters/DatabaseCatalog.cpp` switched to `auto`.
In `Analyzer/Resolve/`:
- `TypoCorrection::collectIdentifierTypoHints` return type and its
local `prompting_strings` switched to WMT.
- `resolveFunction.cpp`: local `possible_function_names` is WMT
to accept iterator ranges from the converted factory getters.
`Server/NotFoundHandler` and `Server/KeeperNotFoundHandler` (which
consume `IHints::getHints` results via their ctor) take WMT.
`Core/PostgreSQLProtocol.h::BindQuery::parameters` and
`PreparedStatementsManager::getStatement(... arguments)` are
restored to WMT (the previous revert is rolled back) by also
converting `Parsers/ParserPreparedStatement.h::ASTExecute::arguments`.
`Core/SettingsChangesHistory.h`: the nested
`SettingsChangesHistory::SettingsChanges` alias and
`VersionToSettingsChangesMap` are converted to WMT.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`Core/BaseSettings.h` and `Core/SettingsEnums.h` define the macros
that every `*Settings` file expands. Each expansion produces static
per-settings-class registry tables. Switch the underlying container
types to WMT — this propagates to every settings file in the tree
on rebuild:
`Core/BaseSettings.h`:
- `CustomSettingMap` (`std::unordered_map<String, SettingFieldCustom, StringHash, std::equal_to<>>`)
→ `UnorderedMapWithMemoryTracking`.
- `AliasMap` (`std::unordered_map<std::string_view, std::string_view>`)
→ `UnorderedMapWithMemoryTracking`.
- The static `field_infos` and `name_to_index_map` members
inside the `DECLARE_SETTINGS_TRAITS_COMMON` macro → WMT
(`VectorWithMemoryTracking` and `UnorderedMapWithMemoryTracking`).
- `SettingsToAliasesMap` (`std::unordered_map<std::string_view, std::vector<std::string_view>>`)
and its in-place lambda local in `settingsToAliases` → WMT
(both outer and inner).
`Core/SettingsEnums.h`:
- The two static `map` lookups inside `IMPLEMENT_SETTING_ENUM_IMPL`
(`EnumType -> String` and `std::string_view -> EnumType`) → WMT.
The macro expansions trigger rebuilds across every settings file
(~50+ TUs), so this commit touches a lot indirectly but only edits
two headers.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`src/Examples/main.cpp` had a single `std::vector<char *> args(argv, argv + argc)` local that wraps `argv`. Switch it to `VectorWithMemoryTracking<char *>`. The downstream `func(static_cast<int>(args.size()), args.data())` call passes `args.data()` (a `char **`) so the WMT element type is unchanged. Add `src/Examples` to the std-containers lint list. Other non-linted src/ directories still have 100+ raw hits each (Core has 19 — mostly deferred high-ripple aliases destined for a separate PR — and the larger dirs `Backups`/`Formats`/`Server` have 149-2529 hits each), so they remain unlinted on this branch. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Workflow [PR], commit [1702957] Summary: ✅
AI ReviewSummaryThis PR broadens Findings
Tests
Final VerdictStatus: Minimum required action: resolve the remaining allocator-lifetime findings by splitting generic query-local aliases from persistent carriers, reverting persistent/static/session containers to plain |
| const Block & getSampleBlock() const { return table_description.sample_block; } | ||
|
|
||
| using ArrayInfo = std::unordered_map<size_t, PostgreSQLArrayInfo>; | ||
| using ArrayInfo = UnorderedMapWithMemoryTracking<size_t, PostgreSQLArrayInfo>; |
There was a problem hiding this comment.
StorageData keeps this alias as the const array_info member below, and the StorageData objects live inside the background MaterializedPostgreSQLConsumer across scheduled replication runs. With UnorderedMapWithMemoryTracking, the CREATE/startup path that builds the consumer now pays for per-table PostgreSQL array metadata through its current tracker, while the map is freed only when replication is stopped/reloaded on the storage/background lifetime. The same StorageData also embeds ExternalResultDescription::types, which this PR changes to a tracked vector. Please keep this storage-owned replication metadata on plain containers (with the style allow marker), or construct/own it under a stable storage/global tracker; the per-query PostgreSQLSource::array_info can still use the tracked map if that is the desired boundary.
I already expressed this opinion in previous discussions: all new exceptions can be thrown only from allocations. If we have code that expects allocations not to throw (and we definitely had it :), we should fix it. And not tailor to it. I think it is fine to take specifically |
Algunenano
left a comment
There was a problem hiding this comment.
Ok for me. We can go ahead and if we find issues we'll just fix them. Let's not stop this because it's a good step forward in general
# Conflicts: # src/Interpreters/Set.cpp # src/Storages/MergeTree/MergeTreeSettings.h
These were swept in by a 'git add -A' while committing the merge resolution; they are local scratch files and should not be tracked. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The merge commit mis-resolved these submodule gitlinks to the stale branch-side SHAs instead of taking master's newer ones, which broke the build (e.g. mongo-cxx-driver's cmake wrapper expects the newer layout). Restore them to match origin/master so the branch does not change contribs. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
|
||
| Block sample_block; | ||
| std::vector<std::pair<ValueType, bool /* is_nullable */>> types; | ||
| VectorWithMemoryTracking<std::pair<ValueType, bool /* is_nullable */>> types; |
There was a problem hiding this comment.
ExternalResultDescription is retained inside long-lived sources, not only per-query input-format scratch: CassandraSource, RedisSource, LibraryDictionarySource, and MaterializedPostgreSQLConsumer::StorageData all store it as a member. Changing types to VectorWithMemoryTracking means dictionary reload/startup or CREATE paths allocate this vector through whatever CurrentMemoryTracker is active, while the source/consumer keeps it until dictionary/storage reload or shutdown. That can make a low-limit query/DDL fail while allocating persistent source metadata and leaves accounting tied to the wrong lifetime. Please keep this member on a plain std::vector with the style allow marker, or construct these long-lived descriptions under blocked/stable tracking.
Master added an EndOfStream accumulator in `ClientBase.cpp` that built a plain `std::vector<Block>` and passed it to `concatenateBlocks(const Blocks &)`. On this branch `Blocks` is `VectorWithMemoryTracking<Block>`, so the default allocator vector no longer converts. Declare the accumulator as `Blocks`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 441/502 (87.85%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 11 line(s) · Uncovered code |
Apply `*WithMemoryTracking` containers to `BridgeHelper` and some `Core` subdirectories
Changelog category (leave one):
Version info
26.7.1.57