Repository navigation
Conversation
|
Workflow [PR], commit [47c898a] AI ReviewSummaryAdds SQL-managed Missing context / blind spots
Findings❌ Blockers
Final VerdictStatus: ❌ Block The two findings were explicitly deferred and remain summary-only. Before approval, close the macro-spelled topology authorization bypass and make accepted SQL cluster names consistent across creation, lookup, deletion, and reload, with focused regression coverage. |
… to NamedCollections.
…rence. Clear nested vectors in ASTSQLClusterShard and ASTSQLClusterDefinition clone methods so ALTER CLUSTER does not duplicate shards and replicas.
Document CREATE/ALTER/DROP CLUSTER syntax, metadata storage, system.clusters columns, and integration with Distributed tables and navigation entries.
Document that ALTER CLUSTER replaces the full topology without incremental updates, remove implementation-specific wording from user docs, and cover single-replica SHARD syntax in 05045_sql_cluster.
|
@groeneai Help investigate CI failures and give me some fix advice. |
|
All four integration failures are one root cause, and it is not in the test: the server refuses to boot with a From
Fix: register the section in Three things that will surface on the next run once the boot works:
One isolation point worth fixing while you are there: the four scenarios share one module-scoped cluster and reuse the same metadata path (both local arms use
Nothing else at On the scope validation you mentioned: rejecting a mis-scoped property earlier is a better error message, but it does not make the syntax work. |
… config. Register cluster_metadata as a known config section so servers can start with metadata storage enabled. Validate SQL cluster properties at DDL time, reject name conflicts with config and discovery clusters, and preserve SQL-managed clusters across config reloads while bumping clusters_version for DDL worker notifications. Fix integration test isolation and local metadata checks, migrate 05045 to a SQL test, and document user/password inheritance defaults.
Revert direct changes inside the AUTOGENERATED region of distributed.mdx and update the table engine Documentation string instead, so docs CI accepts the PR without the pr-autogenerated-docs label.
The test env removes the config `default` cluster, so CREATE CLUSTER default succeeded instead of raising CLUSTER_ALREADY_EXISTS.
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/CMakeFiles/dbms.dir/Common/SQLClusters/SQLClusterMetadataStorage.cpp.o |
new | 338.44 KiB | +338.44 KiB |
src/CMakeFiles/dbms.dir/Common/SQLClusters/SQLClusterFactory.cpp.o |
new | 337.13 KiB | +337.13 KiB |
src/CMakeFiles/dbms.dir/Access/ContextAccess.cpp.o |
1.16 MiB | 1.41 MiB | +255.96 KiB (+21.52%) |
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ASTSQLClusterQuery.cpp.o |
new | 174.52 KiB | +174.52 KiB |
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserSQLClusterQuery.cpp.o |
new | 90.94 KiB | +90.94 KiB |
src/CMakeFiles/dbms.dir/Interpreters/InterpreterSQLClusterQuery.cpp.o |
new | 55.73 KiB | +55.73 KiB |
src/CMakeFiles/dbms.dir/Access/AccessRights.cpp.o |
504.51 KiB | 540.39 KiB | +35.88 KiB (+7.11%) |
src/CMakeFiles/dbms.dir/Interpreters/Context.cpp.o |
3.67 MiB | 3.69 MiB | +27.34 KiB (+0.73%) |
src/CMakeFiles/dbms.dir/Interpreters/Cluster.cpp.o |
340.63 KiB | 359.78 KiB | +19.15 KiB (+5.62%) |
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units
1797 translation units recompiled, 8534 s compile time in total, 1792 of them have a recent master baseline.
Median compile-time ratio to the baselines is ×0.95 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost -684.3 s (-7%) in total before that adjustment.
groeneai
left a comment
There was a problem hiding this comment.
I read the delta since 906da965.
1. Style check is red on the new head e7c8948 (report): settings_changes_history reports that master is now on 26.12, so the record of ignore_on_cluster_for_replicated_sql_cluster_queries (Settings.cpp:3521) has to move from "26.11" to "26.12".
2. 22c7c79 (dropping the {macros} ban) brings back item 6 of my 2026-11-08 comment, and such a name can also keep a server from starting. I ran this on the CI amd_release binary of c8166ad4, one server with <macros><replica>r1</replica></macros> and local metadata storage:
CREATE CLUSTER `c_{replica}` (SHARD (...))succeeds and writessql_clusters_metadata/c_%7Breplica%7D.sql. The cluster is not insystem.clusters, and bothcluster('c_{replica}', system.one)andDistributed('c_{replica}', ...)fail withCLUSTER_DOESNT_EXIST, because the lookup expands the name toc_r1.- After I removed the
replicamacro and restarted, the server exited with code 36:SQLClusterFactory::loadIfNotat startup throwsBAD_ARGUMENTS: Failed to expand macros in cluster name: No macro 'replica' in config ... 'c_{replica}'fromreloadFromStorage, wheretryGetClusterexpands the stored name. Withcluster_metadata.type = keeper, every server that shares the metadata and lacks that macro fails to start the same way (a running one, from the code, keeps failing the background reload and stops applying SQL cluster DDL from the others).
The case deferred in the bot's thread (a Replicated database whose name is spelled with macros) does not need the ban to go: the ban only rejected { in SQL cluster DDL, so restoring validateSQLClusterName fixes the above without touching database names.
The plan-based job you flagged failed only 05829_autopr_skip_index_on_read_in_subquery on c8166ad4. That test failed in 109 PRs and 50 master runs on 2026-11-19, #132867 fixed it, and e7c8948 includes the fix. I have nothing on the rest of the delta (the async queue pool changes, the all_groups. guard, SecretString).
Thanks. The second is a common issue which has existed in other DDLs. We probably don't need to address it in this PR. |
…26.12` The setting is introduced on the current version. Its history record was `26.11`, so the settings-history check rejects it after `master` moved to `26.12`. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116757&sha=e7c8948fc965b69b05d4363f37253d8b02d6b246&name_0=PR&name_1=Style%20check PR: ClickHouse#116757 Co-authored-by: Young <[email protected]>
… feature/sql-cluster-simple Co-authored-by: Young <[email protected]>
…t supplied its addresses `createPool` read `getCluster` again and reused a replica pool by host, user and port, ignoring `cluster_secret`. An `ALTER CLUSTER` in that window stored one generation's addresses with the next generation's pool. Both now come from one `Cluster`, and the pool match includes the secret, compression and priority. PR: ClickHouse#116757 Co-authored-by: Young <[email protected]>
…er-simple Keep the SQL cluster privilege rows in `SHOW PRIVILEGES`, and keep the new column added on `master`. Co-authored-by: Young <[email protected]>
…resh `getDirectoryQueue` copies the cluster before `createPool` pauses, so `05829_sql_cluster_pool_refresh_keeps_previous_endpoint` no longer expects `CLUSTER_DOESNT_EXIST`. The resumed insert must be sent as the endpoint captured before the drop. Co-authored-by: Young <[email protected]>
groeneai
left a comment
There was a problem hiding this comment.
I read the delta since e7c8948. I have nothing on the code of 780781b and d9a7e6d: both paths in getDirectoryQueue now take the addresses and the pool from the same getCluster() result.
I ran both tests on the CI amd_release binaries of d104e466 (before 780781b) and d9a7e6d2. Both fail on the first and pass on the second:
05837_sql_cluster_secret_rollback_keeps_snapshot: ond104e466,SYSTEM FLUSH DISTRIBUTEDfails withALL_CONNECTION_TRIES_FAILED, the server logsInterserver authentication failed, and the count is0.05829_sql_cluster_pool_refresh_keeps_previous_endpoint: ond104e466, the refresh insert fails withCLUSTER_DOESNT_EXISTfromcreatePool.
CI on d9a7e6d2 has no failed check.
Small: 05829 now asserts that the block reaches the new endpoint, so keeps_previous_endpoint in its name says the opposite. The failpoint distributed_async_insert_queue_pause_before_pool_cluster_lookup also no longer comes before a cluster lookup.
…lpoint `05829_sql_cluster_pool_refresh_keeps_previous_endpoint` asserts that the block reaches the new endpoint, so it is now `05829_sql_cluster_pool_refresh_after_drop_uses_new_endpoint`. The failpoint `distributed_async_insert_queue_pause_before_pool_cluster_lookup` no longer precedes a cluster lookup, because `createPool` receives the cluster snapshot. It is now `distributed_async_insert_queue_pause_in_create_pool`. PR: ClickHouse#116757 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 Status update (head
|
|
Both renames in 124200a look right, and the old names are gone from the PR. On the
|
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=4 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
`formatPropertiesAssignments` compared those property names by exact spelling, so `SECRET` and `Password` stayed visible in `system.clusters` and `system.distributed_ddl_queue`. https: //github.com/ClickHouse/pull/116757#discussion_r4659264451 Co-authored-by: Young <[email protected]>
Local metadata storage keeps the clause, and distributed DDL checks `CLUSTER` before running it. Keeper storage drops the clause by default, so that grant is only required when the clause is executed. https: //github.com/ClickHouse/pull/116757#discussion_r4659264452 Co-authored-by: Young <[email protected]>
`validateClusterLevelProperties` compared the original spelling, so `SECRET` and `Password` were rejected before a cluster could be stored. Lookups and the keys written into the cluster config now use the canonical lowercase name. The stored `CREATE` statement keeps the spelling from the query. https: //s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116757&sha=43aa8bd48b62e9deeb1193e64243c5ad785a5863&name_0=PR&name_1=Fast%20test https: //github.com/ClickHouse/pull/116757 Co-authored-by: Young <[email protected]>
`equalsCaseInsensitive` and `toLowerCopyASCII` already compare ASCII identifiers without applying the locale. The local `strncasecmp` and `std::tolower` copies are unnecessary. Co-authored-by: Young <[email protected]>
`SettingsChanges::setSettings` matches names exactly, so `user` and `USER` stayed as two entries and the shard value was written last. Merge with `equalsCaseInsensitive` so a replica property replaces the shard and cluster property of the same name. Co-authored-by: Young <[email protected]>
groeneai
left a comment
There was a problem hiding this comment.
I re-reviewed the 5 commits since 124200a (head 399173b). Nothing blocking from me.
Measured on the CI build_amd_release binary of 399173b (one server, local metadata storage, embedded Keeper, a config cluster for ON CLUSTER):
- Masking:
SeCrEt,`PASSWORD`,PassWordandPASSWORDat cluster, shard and replica scope are[HIDDEN]insystem.clusters.create_query, insystem.query_log(QueryStartandQueryFinish) and insystem.distributed_ddl_queueafterCREATE CLUSTER ... ON CLUSTER. - The mixed-case secret is applied: with
SECRET = 'abc'the secondary query ofcluster(...)runs as the initial user, the same as withsecret = 'abc'; without a secret it runs asdefault. - Merge: the case from the bot thread (cluster
user, shardUSER, replicauser) givesreplica_user,shard_userandcluster_user, andsystem.clustersis identical after a restart. - Validation is case-insensitive in every case I tried:
Weight = -1,Port = 70000,Secure = 'maybe', and duplicates in one scope (user/USER,SECRET/secret,host/HOST,Port/PORT) all fail withBAD_ARGUMENTS;SECURE = 1without a port looks uptcp_port_secure. - Docs: with local storage,
CREATE CLUSTER ... ON CLUSTERby a user with onlyCREATE CLUSTERfails withACCESS_DENIED(CLUSTER ON *.*) and works afterGRANT CLUSTER, as the new paragraph says.
One small suggestion: 05483 has only an exact-case duplicate (user, user). A mixed-case one (user = 'a', USER = 'b') would pin the check that mergeProperties relies on, since it replaces only the first match.
CI: the only red check is 02423_ddl_for_opentelemetry in Stateless tests (arm_asan_ubsan, azure, targeted) ([operation_name like 'TCPHandler' ]=2, expected: 1). The same assertion failed the same day on 2 other PRs that do not touch DDL code (report 1, report 2), so I don't think this PR causes it.
…er-simple Co-authored-by: Young <[email protected]>
Related: #93137.
This is a new implementation of SQL-managed cluster definitions.
The earlier approach on branch
feature-sql-cluster-interface(#102405) grew too complex: separateCREATE ENDPOINT/CREATE SHARD/CREATE CLUSTERcatalog layers, distributed DDL viaON CLUSTER, and a dedicatedClusterMetadataDDLWorker. This PR replaces that design with a simpler model:CREATE CLUSTER/ALTER CLUSTER/DROP CLUSTERsyntax withSHARDandREPLICA<cluster_metadata>, modeled afterNamedCollectionssourceandcreate_querycolumns insystem.clustersfor SQL-managed clustersCREATE SQL CLUSTER,ALTER SQL CLUSTER,DROP SQL CLUSTERMetadata storage
Configured via
<cluster_metadata>in the server config. Supported backends:typelocal(default).sqlfiles under{data_path}/sql_clusters_metadataon each nodelocal_encryptedlocal, with encryption (key_hex,algorithm)keeper/zookeeperkeeper_encrypted/zookeeper_encryptedkeeper, with encryptionExample config for local storage:
Example config for Keeper storage:
Each SQL-managed cluster is stored as a single
CREATE CLUSTER ...statement. On startup,SQLClusterFactoryloads metadata intoContext; local DDL updates both storage and in-memory cluster definitions immediately.Local vs Keeper behavior
ON CLUSTERto run DDL on all nodes so every replica gets its own metadata file. Covered by integration tests (test_local_storage_on_cluster,test_local_storage_encrypted_on_cluster).SQLClusterFactory::updateFunc). Covered by integration tests (test_keeper_storage,test_keeper_storage_encrypted).All three statements also accept an optional
ON CLUSTERclause and are executed through the existing distributed DDL infrastructure when it is present.Example
CREATE CLUSTER my_cluster ( user = 'Me', SHARD ( user = 'Me', password = 'p@s$w0rd', REPLICA (host = 'abc.clickhouse.cloud', port = 9000), REPLICA (host = 'def.clickhouse.cloud', port = 9000, user = 'Alexey', password = 'qwerty') ), SHARD ( user = 'Me', password = 'p@s$w0rd', host = 'xyz.clickhouse.cloud', port = 9000 ) ); -- local storage: distribute DDL to all nodes CREATE CLUSTER my_cluster ON CLUSTER 'my_clickhouse_cluster' (...); ALTER CLUSTER my_cluster ( user = 'Me', SHARD ( REPLICA (host = 'abc.clickhouse.cloud', port = 9000), REPLICA (host = 'def.clickhouse.cloud', port = 9000) ) ); DROP CLUSTER my_cluster;SQL-managed clusters appear in
system.clusterswithsource = 'SQL'and the storedcreate_query. Secrets increate_queryare hidden according to the same rules assystem.named_collections.Config reload behavior
An error in
remote_servers(for example, an invalid shard or a config cluster whose name collides with an existing SQL-managed cluster) now makes every config reload fail until the config is fixed, and the old clusters stay installed. This also applies to servers that never use SQL-managed clusters. Onmasterthe second reload only appeared to succeed because the first one had already recorded the config while the cluster map was half-applied.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add SQL-managed
CREATE CLUSTER,ALTER CLUSTER, andDROP CLUSTERstatements with local or Keeper-backed metadata storage.Workflow [PR]
Sync PR [sync-upstream/pr/116757]