Skip to content

Fix DataLakeCatalog table creation issues - #2792

Merged
zvonand merged 3 commits into
antalya-26.8from
fix/antalya-26.8/issue-2500
Nov 5, 2026
Merged

zvonand merged 3 commits into
antalya-26.8from
fix/antalya-26.8/issue-2500

Conversation

@zvonand

@zvonand zvonand commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes defects 1–3 from the audit of native CREATE TABLE / DROP TABLE for DataLakeCatalog:

  • CREATE TABLE ... AS from an S3 Tables catalog table without keys no longer throws LOGICAL_ERROR. A table shown without storage is accepted as a source only when the target is a DataLakeCatalog database.
  • Engine SETTINGS of a table created in a DataLakeCatalog are now rejected when they would be lost when the table is reopened. This covers format settings, and storage settings that differ from the database value. iceberg_format_version and obsolete settings are still accepted. iceberg_* settings can now be set at the database level.
  • Iceberg metadata-log now records the previous metadata file for TRUNCATE, OPTIMIZE ... MANIFEST, schema ALTERs and EXPORT PARTITION. Before, it recorded the new file itself or nothing.

Related: #2500
Follow-up for: #2305

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Fix CREATE TABLE ... AS from an S3 Tables table without keys, reject DataLakeCatalog table settings that are lost on reopen, allow iceberg_* settings at the DataLakeCatalog database level, and record the previous metadata file in Iceberg metadata-log for TRUNCATE, manifest compaction, ALTER and EXPORT PARTITION.

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

@zvonand zvonand added antalya port-antalya PRs to be ported to all new Antalya releases antalya-26.8 labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [69fa635]

@zvonand

zvonand commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@blau-ai

@blau-ai

blau-ai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

CI triage for 69fa635

Verdict: none of the 7 failing checks look caused by this PR. 5 also fail on other antalya-26.8 PRs, including the already-merged #2773. 1 is infra (a test container could not start). 1 (s3_azure_1) has the same root cause as a failure that does repeat on other PRs, but only this PR ran that suite. No code changes are needed here.

Check Failing tests Verdict
Integration 5/8 21× test_storage_iceberg_with_spark/test_export_partition_iceberg.py Pre-existing on base
Integration 5/8 37× test_cas_gcs/test.py Infra (container didn't start)
Integration 1/8, 7/8 2× test_backward_compatibility/test_custom_s3_disk_remote_url_allow_hosts.py Pre-existing on base
Stateless amd_asan_ubsan cas s3 1/2, 2/2 none (job stopped mid-run) Pre-existing (job timeout)
Regression s3_azure_1 /s3/azure/part 1/disk/{remote host filter,syntax} Not PR-related (same root cause as the backward-compat failure)
Regression swarms 3 scenarios Pre-existing on base

Details

1. test_export_partition_iceberg.py (21 tests): pre-existing

Code: 497. DB::Exception: default: Not enough privileges. To execute this query, it's necessary to have the grant SHOW NAMED COLLECTIONS SECRETS ON s3.
  at helpers/iceberg_utils.py:480 create_iceberg_table

This touches Iceberg, so I checked it carefully. The same 21 tests fail with the same count on #2773 (merged), #2794 and #2800. None of those touch DataLake code. The PR's InterpreterCreateQuery change only affects the CREATE ... AS <datalake catalog table> path. These tests fail earlier, at a named-collection access check. → Base-branch problem: either the test user needs the grant or there's an access regression on antalya-26.8. Fix it separately.

2. test_cas_gcs/test.py (37 tests): infra / test environment

Timed out while waiting for instance `fakegcs' ... to start.
bash: line 1: /usr/bin/clickhouse: cannot execute: required file not found

The fake GCS container never started because the binary inside it couldn't be executed, so every test in the module failed at the fixture. The PR doesn't touch CAS/GCS. Safe to re-run. If it repeats, the fakegcs container setup needs fixing on base.

3. test_custom_s3_disk_remote_url_allow_hosts.py (2 tests, shards 1/8 and 7/8): pre-existing
The node container times out on startup (cluster.start() fixture). Same 2 failures on #2773, #2794 and #2800 (and in their targeted jobs). Probably related to the upstream backports ClickHouse#124453 / ClickHouse#124930 (remote_url_allow_hosts for S3 disks) on base.

4. Stateless amd_asan_ubsan, cas s3 storage, parallel 1/2 and 2/2: pre-existing job timeout
No individual test failed. Both shards were cut off at about 3h38m, at 3661/6890 and 2820/6931 tests. #2773 shows the same ERROR-in-the-middle-of-the-run pattern on both shards. The suite is too slow under ASan with CAS S3 and doesn't fit the job timeout.

5. Regression s3_azure_1: not PR-related

ConfigReloader: Error updating configuration ... URL "http://azurite:10000" is not allowed in configuration file, see <remote_url_allow_hosts>. (UNACCEPTABLE_URL)

The disk config is rejected by the new remote_url_allow_hosts enforcement on S3/Azure disks. That's the same base change as item 3, and the PR doesn't touch disk config. Caveat: none of the other PRs I compared ran this suite, so I couldn't check it directly against base. The regression config probably needs azurite added to remote_url_allow_hosts.

6. Regression swarms: pre-existing
Fails on every recent antalya-26.8 PR I checked (#2773, #2794, #2799, #2800).

Suggested next steps

  • Nothing to fix in this PR. The rest of the Iceberg/DataLake integration shards that cover the changed code passed (e.g. Integration 2/8).
  • Optionally re-run Integration 5/8 to get a clean test_cas_gcs result.
  • Track separately on base: the SHOW NAMED COLLECTIONS SECRETS failure in the export-partition tests, the remote_url_allow_hosts breakage (backward-compat test + azure regression), and the CAS-S3 ASan stateless timeout.

Evidence: praktika result_pr.json for this PR and for #2773/#2794/#2800, plus the GitHub Actions logs of run 42001873005. Several jobs (stress, AST fuzzer, some stateless) were DROPPED/skipped, so they give no signal either way.

@zvonand
zvonand merged commit 28fb5ab into antalya-26.8 Nov 5, 2026
308 of 323 checks passed
@zvonand

zvonand commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

@Selfeer could you pls also verify this one?

@Selfeer

Selfeer commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

On it

@Selfeer

Selfeer commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Defects in #2792

Medium: plain OPTIMIZE TABLE still records the new metadata file in metadata-log

Description

The PR fixes defect 3 of #2500 only partly. OPTIMIZE TABLE without MANIFEST goes through bin-pack compaction when:

  • the build is not ClickHouse Cloud,
  • the table is format version 2,
  • the table has no live position deletes.

Bin-pack logs the metadata file it is about to write, not the file it replaces. So the new vN+1.metadata.json lists itself in metadata-log, and vN.metadata.json is never recorded.

The PR fixed this same bug for TRUNCATE, OPTIMIZE ... MANIFEST, ALTER and EXPORT PARTITION, but not for bin-pack. The full rewrite (compactIcebergTable) is fine: it deletes every old metadata file, so an empty metadata-log is correct there.

Steps to reproduce

  1. Create a local Iceberg table and add two small data files, which bin-pack groups together with the default size thresholds:

    T=/var/lib/clickhouse/user_files/binpack_repro
    clickhouse-client -q "CREATE TABLE binpack_repro (a Int32) ENGINE = IcebergLocal('$T/', 'Parquet')"
    clickhouse-client --allow_insert_into_iceberg=1 -q "INSERT INTO binpack_repro VALUES (1)"
    clickhouse-client --allow_insert_into_iceberg=1 -q "INSERT INTO binpack_repro VALUES (2)"
  2. Run a plain OPTIMIZE, without MANIFEST:

    clickhouse-client --allow_experimental_iceberg_compaction=1 -q "OPTIMIZE TABLE binpack_repro"
  3. Print the newest metadata file and the last entry of its metadata-log:

    LATEST=$(ls "$T/metadata" | grep -E '^v[0-9]+\.metadata\.json$' | sort -V | tail -1)
    echo "$LATEST"
    jq -r '."metadata-log"[-1]."metadata-file"' "$T/metadata/$LATEST"
  • Expected: the last entry names the previous file, for example .../v3.metadata.json when the newest file is v4.metadata.json.
  • Actual: the last entry names the newest file itself (.../v4.metadata.json).

The new test 05428_iceberg_metadata_log_previous_file.sh runs only OPTIMIZE ... MANIFEST, so it does not catch this. #2500 reproduces defect 3 with plain OPTIMIZE TABLE.

Fix direction

Return the resolved metadata path from readLatestMetadata, and pass path_resolver.reverseResolve(path) to generateReplaceSnapshot.

Regression test direction

In 05428_iceberg_metadata_log_previous_file.sh, run two INSERTs and a plain OPTIMIZE TABLE, then call check_metadata_log.

Status of #2500

#2500 defect Status at 69fa6353
1. CREATE TABLE ... AS from an S3 Tables table with no keys throws LOGICAL_ERROR Fixed.
2. Table-level engine SETTINGS are lost after restart Fixed when ENGINE is given explicitly. Without ENGINE, SETTINGS are rejected, as before the PR.
3. metadata-log misses the previous file or records the wrong one Partly fixed. Bin-pack OPTIMIZE TABLE is still wrong (see the Medium finding above).
4. RENAME DATABASE ... ON CLUSTER bypasses the guard Not addressed. The PR does not claim this one.

How each one was checked:

  1. A source from a DataLakeCatalog with no storage clause now reaches the DataLakeCatalog branch of setEngine. If the target is not a DataLakeCatalog, the query fails with INCORRECT_QUERY instead of LOGICAL_ERROR. Keys are copied only when the source has them.
  2. validateCreateTableEngine rejects format settings, and storage settings whose value differs from the database value. It compares against the same getTableStorageSettings that tryGetTableImpl uses when the table is reopened.
  3. TRUNCATE, OPTIMIZE ... MANIFEST, schema ALTER and EXPORT PARTITION now log the previous file, including on retries.
  4. executeDDLQueryOnCluster.cpp:70 still checks !rename->database. The PR links Defects found for PR #2305 #2500 with Related:, so merging it does not close the issue.

Scope and limits

  • Reviewed: all 12 changed source files, and every caller of generateNextMetadata, appendReplaceSnapshot and appendMetadataLog.
  • Not done: nothing was built or run. The steps to reproduce were worked out from the code.
  • Confidence: high for the bin-pack finding, because the code path is direct. Running the steps above would confirm it.

@Selfeer Selfeer added the verified Approved for release label Nov 19, 2026
@Selfeer

Selfeer commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

@zvonand marking this as verified, I don't have the issue with the PR itself. But below audit finding - do you need me to create a ticket for the future followup?

@Selfeer Selfeer added the verified-with-issues Verified by QA and issues found. label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

antalya antalya-26.8 antalya-26.8.39.20001 port-antalya PRs to be ported to all new Antalya releases verified Approved for release verified-with-issues Verified by QA and issues found.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants