Repository navigation
Fix loading AzureBlobStorage tables whose engine arguments end with partition_strategy = 'none' - #122707
Conversation
… parser Since ClickHouse#115277 the server persists an implicit `none` partition strategy of an object storage table as a trailing `partition_strategy = 'none'` engine argument, for S3 and Azure. The Azure readers of a positional argument list, `AzureStorageParsedArguments::fromAST` and `addStructureAndFormatToArgsIfNeededAzure`, evaluated every argument as a constant expression, so that `equals` node failed with UNKNOWN_IDENTIFIER. An AzureBlobStorage table created with PARTITION BY under `file_like_engine_default_partition_strategy = 'wildcard'` (the default for `compatibility` older than 26.6) could not be attached again, and the server did not start. Both readers now split off the trailing `identifier = value` arguments. `fromAST` accepts `partition_strategy` and `partition_columns_in_data_file` there, applies them like their positional forms and keeps the arguments in the AST as written. Other keys, a key given both positionally and as a key-value argument, and key-value arguments after fewer than three positional ones are rejected. The key must be an identifier, so a positional constant such as `1 = 1` keeps its meaning. `addStructureAndFormatToArgsIfNeededAzure` completes the positional arguments and appends the key-value ones back. The reading side is fixed because only it lets tables already written by 26.8 and 26.9 load again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…strategy A key-value `partition_strategy = 'hive'` in the AzureBlobStorage engine or the azureBlobStorage table function left `partition_columns_in_data_file` at the struct default `true` when the companion argument was absent, so the partition columns were written into every data file. The documented default is `false`, and the named-collection form of this engine and the S3 parser already compute it from the strategy. Apply the same default on the key-value path. An explicit `partition_columns_in_data_file` still wins. The positional forms keep their current value, because tables created with them already have data files written that way; the key-value path is new, so no existing table depends on it. The test gets two write arms against Azurite that count the columns of the written Parquet file: 1 by default, 2 with `partition_columns_in_data_file = 1`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the second line of the countPositionalArguments comment; the commit message of the fix already explains why `1 = 1` stays positional. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Independent-model review (codex: 3 findings on the full pass, 0 on the delta recheck after the fix round) plus my own review of the diff.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260928-153300 |
|
Workflow [PR], commit [542f5c1] Summary: ✅
AI ReviewSummaryThis PR fixes reloading Missing context / blind spots
Final VerdictStatus: ✅ Approve. No unresolved code findings; current-head CI results remain pending. |
…rguments The query an `azureBlobStorageCluster` initiator forwards to the replicas (and an `azureBlobStorage` query converted by `parallel_replicas_for_cluster_engines`) is rewritten by `addStructureAndFormatToArgsIfNeededAzure`, which evaluated every argument as a constant, including `extra_credentials(...)`. Such a query failed with UNKNOWN_IDENTIFIER `client_id` before anything was sent. The trailing key-value split of the previous commits made it order-dependent too: `fromAST` removes `extra_credentials` before it looks for the trailing `identifier = value` run, the rewrite did not, so `..., partition_strategy = 'none', extra_credentials(...)` was accepted by the parser and rejected by the rewrite. Set `extra_credentials` aside first and append it after the key-value arguments, as `addStructureAndFormatToArgsIfNeededS3` does. The test runs both argument orders of `azureBlobStorageCluster` and the parallel-replicas conversion, and checks in `system.query_log` that every initial query was forwarded with `extra_credentials`; the replicas then fail to send the workload-identity token over plain http. Without this change each query fails with Code 47; with the extraction but without the re-append the queries are forwarded without the credentials and the check returns 0. Also list `extra_credentials` in the `azureBlobStorageCluster` documentation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ables `AzureStorageParsedArguments::fromAST` removes `extra_credentials(...)` from the engine arguments and never puts it back, and those arguments are what `CREATE` writes into the table metadata. After a restart or DETACH/ATTACH the table lost its `client_id` and `tenant_id` and authenticated with whatever the URL alone implies. Append it back at the end, as the S3 parser does. The one- and two-argument forms ignore `extra_credentials` and still drop it. The test is a unit test because a stateless test cannot reach this: `CREATE` with `extra_credentials` authenticates to check the container, which is refused over plain http, and a full `ATTACH` needs a fixed table UUID. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes4 object files changed (+26.20 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 units7 translation units recompiled, 12 s compile time in total, 7 of them have a recent master baseline. |
…age-partition-strategy-key-value Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age-partition-strategy-key-value Resolve the conflict with ClickHouse#127932, which landed the `extra_credentials` handling of this branch on master: `fromAST` re-appends it through a `SCOPE_EXIT`, and the cluster rewrite sets it aside and appends it back. Take master's version of that code and keep only the key-value `partition_strategy` / `partition_columns_in_data_file` handling on top: - `fromAST`: drop this branch's own re-append of `extra_credentials`, master's `SCOPE_EXIT` already does it (keeping both would append it twice). - cluster rewrite: split the trailing key-value arguments off after master's `extractExtraCredentials`, and insert them back before `extra_credentials`, so the rewritten arguments keep the order positional, key-value, `extra_credentials`. - `gtest_azure_configuration.cpp`: take master's file; its `FromASTKeepsExtraCredentialsInEngineArgs` and `AddStructureAndFormatKeepsExtraCredentials` cover what this branch's `FromASTKeepsExtraCredentialsInTableDefinition` covered. - `TableFunctionObjectStorageCluster.cpp`: take master's file; the `extra_credentials` documentation row is not part of the `partition_strategy` fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After merging master, the `extra_credentials` arms of `05291_azure_blob_storage_partition_strategy_key_value` failed for two reasons that have nothing to do with the key-value arguments: - Since 3b7f7be a user query may use the server's workload identity only with `s3_allow_server_credentials_in_user_queries = 1`; without it the initiator answers `ACCESS_DENIED` before rewriting the arguments (05218 enables the setting the same way). - Since ClickHouse#122770 the query log shows `extra_credentials(...)` as '[HIDDEN]', so the old `LIKE '%extra_credentials(client_id%'` oracle matched nothing. Enable the setting for the cluster arms, and make the oracle match the forwarded arguments ending in `partition_strategy = 'none', '[HIDDEN]')`: the key-value arguments first, then `extra_credentials`. Swapping that order in the rewrite turns the result from 3 into 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`fromAST` evaluated the positional engine arguments in place but kept the
key-value `partition_strategy` and `partition_columns_in_data_file`
arguments as written, so the stored table definition kept the expression
and `ATTACH` evaluated it again in another context. A table created with
`partition_strategy = if(getSetting('use_hive_partitioning'), 'hive', 'none')`
under `use_hive_partitioning = 1` lost its hive strategy when attached under
`use_hive_partitioning = 0`. Replace each key-value value with its literal,
as for the positional arguments. The S3 engine also keeps key-value
arguments unevaluated; it is not changed here.
05291: add a DETACH/ATTACH arm that changes the setting in between. Drop
the query_log oracle of the `extra_credentials` cluster arms: the initiator
fails before its replica logs the forwarded query, so `SYSTEM FLUSH LOGS`
could miss it (2 of 100 randomized runs). A gtest now checks that the
cluster rewrite keeps the key-value arguments and then `extra_credentials`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
26.8 lacks the Azure key-value / extra_credentials argument handling; keep the incoming additions (matches a from-scratch cherry-pick onto 26.8).
26.9 lacks the Azure key-value / extra_credentials argument handling; keep the incoming additions (matches a from-scratch cherry-pick onto 26.9).
26.10 lacks the Azure key-value / extra_credentials argument handling; keep the incoming additions (matches a from-scratch cherry-pick onto 26.10).
Cherry pick #122707 to 26.8: Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
… engine arguments end with `partition_strategy = 'none'`
Cherry pick #122707 to 26.9: Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
… engine arguments end with `partition_strategy = 'none'`
Cherry pick #122707 to 26.10: Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
…e engine arguments end with `partition_strategy = 'none'`
Backport #122707 to 26.8: Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
Backport #122707 to 26.9: Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
Backport #122707 to 26.10: Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
… engine arguments end with `partition_strategy = 'none'`
… engine arguments end with `partition_strategy = 'none'`
…e engine arguments end with `partition_strategy = 'none'`
Related: #115277
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
AzureBlobStoragetables created withPARTITION BYunderfile_like_engine_default_partition_strategy = 'wildcard'(the default forcompatibilityolder than 26.6) that could not be attached again, so the server did not start after a restart. The engine now reads back thepartition_strategy = 'none'argument that the server stores for such tables, and the engine and theazureBlobStoragetable function acceptpartition_strategyandpartition_columns_in_data_fileas key-value arguments.Description
On 26.8 LTS and 26.9 (measured on
26.8.10.6and26.9.1.1629),CREATE TABLE ... ENGINE = AzureBlobStorage(url, container, blob, format) PARTITION BY ...underfile_like_engine_default_partition_strategy = 'wildcard'succeeds, but the table cannot be attached again and after a restart the server does not start:Code: 47 ... Unknown expression or function identifier 'partition_strategy'. Seen asCannot start clickhouse-serverinStress test (arm_tsan): job.#115277 persists an implicit
nonestrategy as a trailingpartition_strategy = 'none'argument for S3 and Azure, but the two Azure readers,AzureStorageParsedArguments::fromASTandaddStructureAndFormatToArgsIfNeededAzure, evaluate every argument as a constant.Both readers now split off trailing
identifier = valuearguments.fromASTappliespartition_strategyandpartition_columns_in_data_filelike their positional forms, except that a key-valuehivedefaultspartition_columns_in_data_filetofalse, as documented and as S3 does. It keeps them in the table definition with their values evaluated, like the positional arguments. The second reader, used byCREATE/ATTACHand the cluster rewrite, appends them back after the positional arguments and beforeextra_credentials(...). Other keys, a key given both ways, and key-value arguments after fewer than three positional ones are rejected withBAD_ARGUMENTS. A constant such as1 = 1stays positional.Only a reading-side fix lets tables already written by 26.8/26.9 load again.
The new test fails on master at
ATTACHand passes 150/150 randomized runs. A unit test covers the cluster rewrite. Secret masking is unchanged.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/122707]
Version info
26.11.1.1239-master(included in26.11and later)