Skip to content

Cherry pick #109082 to 26.6: Split remote database and data lake visibility settings - #109221

Merged
robot-ch-test-poll3 merged 9 commits into
backport/26.6/109082from
cherrypick/26.6/109082
Jul 3, 2026
Merged

robot-ch-test-poll3 merged 9 commits into
backport/26.6/109082from
cherrypick/26.6/109082

Conversation

@robot-clickhouse

Copy link
Copy Markdown
Member

Original pull-request #109082

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

pamarcos and others added 8 commits July 1, 2026 16:06
Restore `show_data_lake_catalogs_in_system_tables` for `DataLakeCatalog`
visibility in system introspection tables.

Add `show_remote_databases_in_system_tables`, enabled by default, for `MySQL`
and `PostgreSQL` databases only. Keep separate `IDatabase` APIs so data lake
catalogs and remote databases are classified independently.
Record `show_remote_databases_in_system_tables` with default `true` where the
setting is introduced, and update the `26.6` settings reference accordingly.
Keep the existing remote database integration tests focused on the
`system.columns` visibility behavior restored by this PR. The explicit
`SHOW COLUMNS` and `SHOW INDEX` checks were added together with the original
`show_remote_databases_in_system_tables` change, but they are not needed for
the default remote database visibility coverage.
Add a `show_remote_databases_in_system_tables` entry to the 26.7 settings
changes history block so the Upgrade check passes: the baseline release is
26.6, and the check requires an entry in a version block newer than the
baseline. Keep the values as `true, true` so `compatibility` mode does not
roll the restored default back to `false`.

Tag `04210_show_remote_databases_in_system_tables` as `no-parallel`. The test
registers `PostgreSQL` and `MySQL` databases on an unreachable host; with the
new default `show_remote_databases_in_system_tables = true` they are visible in
`system.tables`, `system.columns` and `system.completions`, so concurrent tests
that scan those tables without a database filter timed out with
`POSTGRESQL_CONNECTION_FAILURE`. This caused failures in 00564_temporary_table_management,
01518_cast_nullable_virtual_system_column, 03566_system_completions_table,
03602_query_system_tables_definer and 00696_system_columns_limit.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109082&sha=latest&name_0=PR
Keep `show_remote_databases_in_system_tables` as a single `26.6` settings-history
entry with default value `true`. This avoids duplicate history entries while keeping the
restored default visible in the generated compatibility reference.
Revert commit e79fd5f and return to the layout from commit 9c7c5ab and
commit 1fc129c: `show_remote_databases_in_system_tables` is recorded as
`{true, true}` in both the `26.2` and the `26.7` settings-history blocks.
The `26.2` entry covers the planned backports to 26.2+ release branches, and
the `26.7` entry satisfies the Upgrade check, which requires an entry in a
block newer than the 26.6 baseline release. Keeping both values `true` means
`compatibility` mode never rolls the restored default back to `false`,
matching the pre-#104416 behavior where `MySQL` and `PostgreSQL` databases
were always visible.
…system-tables

Split remote database and data lake visibility settings
@robot-clickhouse robot-clickhouse added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels Jul 2, 2026
…ypick/26.6/109082

# Conflicts:
#	tests/queries/0_stateless/02995_settings_26_5_1.tsv

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backport of #109082 to the 26.6 branch to restore the original behavior where data-lake catalogs remain hidden from system.tables/system.columns/system.completions by default, while introducing a separate (default-enabled) control for MySQL/PostgreSQL database visibility in those system tables.

Changes:

  • Split visibility controls into show_data_lake_catalogs_in_system_tables (DataLake only) and show_remote_databases_in_system_tables (MySQL/PostgreSQL, default true).
  • Extend DatabaseCatalog::getDatabases filtering to support independent inclusion/exclusion of data-lake catalogs vs remote DBs.
  • Update stateless + integration tests and multiple system-table readers to use the new split behavior.

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.sql Updates stateless test to validate split settings and adds no-parallel justification.
tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.reference Adjusts expected output for the updated stateless test.
tests/queries/0_stateless/02995_settings_26_5_1.tsv Updates baseline settings snapshot to include the new/changed setting.
tests/integration/test_postgresql_database_engine/test.py Removes explicit enabling of show_remote_databases_in_system_tables in queries.
tests/integration/test_mysql57_database_engine/test.py Removes explicit enabling of show_remote_databases_in_system_tables in queries.
tests/integration/test_mysql_database_engine/test.py Removes explicit enabling of show_remote_databases_in_system_tables in queries.
src/Storages/System/StorageSystemTables.cpp Applies split settings when deciding which DBs to scan for system.tables.
src/Storages/System/StorageSystemReplicationQueue.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemReplicas.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemProjections.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemPartsBase.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemPartMovesBetweenShards.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemObjectStorageQueueSettings.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemMutations.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemKafkaConsumers.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemIcebergHistory.cpp Includes data-lake catalogs explicitly when required by the Iceberg system table.
src/Storages/System/StorageSystemIcebergFiles.cpp Includes data-lake catalogs explicitly when required by the Iceberg system table.
src/Storages/System/StorageSystemGraphite.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemDistributionQueue.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemDataSkippingIndices.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemDatabases.cpp Ensures system.databases always includes both datalake + remote DBs regardless of settings.
src/Storages/System/StorageSystemDatabaseReplicas.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemConstraints.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/System/StorageSystemCompletions.cpp Applies split settings when deciding which DBs to scan for completions.
src/Storages/System/StorageSystemColumns.cpp Applies split settings when deciding which DBs to scan for system.columns.
src/Storages/System/StorageSystemClusters.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Storages/StorageMerge.cpp Ensures Merge can enumerate across both datalake + remote DBs when needed.
src/Storages/RocksDB/StorageSystemRocksDB.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Server/ReplicasStatusHandler.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Interpreters/ServerAsynchronousMetrics.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Interpreters/loadMetadata.cpp Adjusts database enumeration to skip data-lake catalogs (new flag).
src/Interpreters/InterpreterSystemQuery.cpp Adjusts database enumeration for various SYSTEM commands (new flag).
src/Interpreters/InterpreterShowTablesQuery.cpp Forces inclusion of the explicitly-requested datalake/remote DB for SHOW TABLES.
src/Interpreters/InterpreterCreateQuery.cpp Counts databases including datalake + remote DBs for max-db-limit checks.
src/Interpreters/InterpreterCheckQuery.cpp Adjusts database enumeration used by CHECK queries (new flag).
src/Interpreters/DatabaseCatalog.h Splits GetDatabasesOptions into with_datalake_catalogs and with_remote_databases.
src/Interpreters/DatabaseCatalog.cpp Implements split filtering and adds helpers for datalake catalogs.
src/Databases/IDatabase.h Adds isDatalakeCatalog classification distinct from isRemoteDatabase.
src/Databases/DataLake/DatabaseDataLake.h Marks DataLake database as isDatalakeCatalog.
src/Core/SettingsChangesHistory.cpp Records the new/changed setting in settings-changes history.
src/Core/Settings.cpp Declares the two separate settings and updates defaults/description.
src/Client/BuzzHouse/Generator/SessionSettings.cpp Adds the new setting to fuzz session settings generation.
src/Backups/BackupEntriesCollector.cpp Ensures backups enumerate DBs including datalake + remote DBs when appropriate.
Comments suppressed due to low confidence (1)

src/Interpreters/InterpreterSystemQuery.cpp:1606

  • This safety check iterates all databases and calls getTablesIterator, which can enumerate tables from remote databases (network calls). The check is about local replicated tables, so it should exclude remote databases.
        for (auto & elem : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}))
        {
            DatabasePtr & database = elem.second;
            for (auto iterator = database->getTablesIterator(getContext()); iterator->isValid(); iterator->next())
            {

Comment on lines +1 to 2

#include <Storages/System/StorageSystemIcebergHistory.h>
Comment on lines 234 to 236
{"allow_fuzz_query_functions", false, false, "New setting to enable the fuzzQuery function."},
{"show_remote_databases_in_system_tables", true, true, "New setting to control whether `MySQL` and `PostgreSQL` databases are shown in `system.tables`, `system.columns` and `system.completions`."},
{"ast_fuzzer_runs", 0, 0, "New setting to enable server-side AST fuzzer."},
waitLoad(TablesLoaderForegroundPoolId, load_metadata);

for (const auto & [name, _] : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_remote_databases = false}))
for (const auto & [name, _] : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}))
{
Strings res;
const auto & databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_remote_databases = false});
const auto & databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false});
Comment on lines +300 to 303
for (auto & elem : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}))
{
startStopActionInDatabase(action_type, start, elem.first, elem.second, getContext(), log);
}
else if (query.is_drop_whole_replica)
{
auto databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_remote_databases = false});
auto databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false});
Comment on lines +2101 to 2104
for (auto & elem : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}))
{
/// skip_not_loaded: act only on already-loaded tables, do not block on async loading.
for (auto it = elem.second->getTablesIterator(getContext(), {}, /*skip_not_loaded=*/ true); it->isValid(); it->next())
Comment on lines +2243 to 2246
for (auto & database : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}))
{
for (auto it = database.second->getTablesIterator(getContext()); it->isValid(); it->next())
{
@robot-ch-test-poll3
robot-ch-test-poll3 merged commit c186b21 into backport/26.6/109082 Jul 3, 2026
1 check passed
@robot-ch-test-poll3
robot-ch-test-poll3 deleted the cherrypick/26.6/109082 branch July 3, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants