Native CREATE TABLE / DROP TABLE for DataLakeCatalog; optionally prune on DROP - #2305
Native CREATE TABLE / DROP TABLE for DataLakeCatalog; optionally prune on DROP#2305zvonand wants to merge 4 commits into
CREATE TABLE / DROP TABLE for DataLakeCatalog; optionally prune on DROP#2305Conversation
Port of ClickHouse#98670: native `CREATE TABLE` and `DROP TABLE` for `DataLakeCatalog`, with an optional catalog-side data purge requested through the new `data_lake_delete_data_on_drop` setting. Dropped: the explicit `catalog->createNamespaceIfNotExists` calls the PR adds to `DatabaseDataLake::createTable` and `IcebergMetadata::createInitial` - `ICatalog` has no such virtual on antalya-26.6, where `RestCatalog::createTable` and `GlueCatalog::createTable` create the namespace themselves Adapted: `toIcebergMetadataCompressionExtension` does not exist on antalya-26.6, so `GlueCatalog::createTable` derives the initial metadata file name with `toContentEncodingName`, reproducing the name `IcebergMetadata::createInitial` produces on this branch; `test_native_create_gzip_metadata` asserts that name Adapted: `RestCatalog` keeps `config` as a direct member instead of a `MultiVersion` state snapshot, so `getDefaultBaseLocation` and the REST endpoints read `config` directly Adapted: the Iceberg REST namespace-identifier fix (`namespaceToJSONArray`) was applied inside `buildUpdateMetadataRequestBody` and `buildUpdateSchemaRequestBody`, where antalya-26.6 builds those request bodies Adapted: `IcebergMetadata::drop` takes the resolved `delete_data` flag; the context its file enumeration needs now comes from `Context::getGlobalContextInstance` Adapted: `DatabaseDataLake` stores its settings in a plain member, not a `MultiVersion`, so `createTable` reads `settings` directly Adapted: the dynamic `DataLakeConfiguration` wrapper's `drop` override was re-signatured to `drop(bool)` Adapted: `ICEBERG_DELTA_SHARING` and `ICEBERG_HORIZON` were removed from the new catalog-type switches - antalya-26.6 does not have those enum values Adapted: `S3TablesCatalog::dropTable` only gains the new parameters; antalya-26.6 always purges and has no `delete_data` guard to extend Adapted: `src/Databases/DatabaseRemote.{h,cpp}` are not on antalya-26.6, so the `dropTable` signature change there does not apply
RelEasy — resolution kept with warningsThe AI resolution was pushed, but a post-resolution check is still failing on it. Nothing was rolled back — please review the point(s) below before merging and either fix them or dismiss them as false positives.
|
CREATE TABLE / DROP TABLE for DataLakeCatalog; optionally prune on DROPCREATE TABLE / DROP TABLE for DataLakeCatalog; optionally prune on DROP
…atalog` * Never remove the initial metadata file when `catalog->createTable` fails: the registration may have succeeded with only its response lost, which leaves the catalog pointing at a deleted object. Roll back only on a definitive answer. * Add `DataLake::TableAlreadyExistsInCatalogException` so `IF NOT EXISTS` swallows only that case instead of any `TABLE_ALREADY_EXISTS` raised below `doCreateTable`, log when it does, and report leftover metadata as what it is. * Keep the data in `StorageObjectStorage::drop` when `prepareForDrop` did not run, instead of falling back to the server-level value. * Log every metadata file removal. * Drop the `isRemoteDatabase` override, which re-coupled `DataLakeCatalog` visibility in `system.tables` to `show_remote_databases_in_system_tables`. * Trim comments; drop those describing behaviour that does not exist.
CI triage for #2305 (head
|
| Check | Class | PR-caused? |
|---|---|---|
Integration 8/8 — test_database_iceberg namespace location (×2) |
native CREATE location bug | Yes |
Integration 3/8 + 8/8 — delete_data_on_drop (×3) |
prune-on-drop no-op | Yes |
Regression iceberg_2 — export partition (×2) |
Iceberg snapshot/manifest data loss | Yes (very likely) |
| Integration 4/8 — server down mid Iceberg SELECT | crash cause unproven | Maybe — re-run |
| Source upload / SQLLogic / SQLStorm / 6/8 git_import | no git egress on runner | No (infra) |
Stateless cas-s3 02265_column_ttl / 02014_… / hung |
CAS backend, non-blocking | No (pre-existing/flaky) |
I can dig into the C++ for fixes to (1)/(2)/(3) and open a blau/* PR, or push directly to releasy/port/pr-98670-2f540f — just say which you'd prefer. (I haven't pushed anything.)
Evidence: praktika result_pr.json, Actions job logs for runs under 33663741558, and the iceberg_2 regression raw.log. I can't build/run ClickHouse in this container, so the root-cause hypotheses above are from static reading of the diff + tests + CI logs; CI on your fix is the real confirmation.
Follow-up: root cause pinned for the two integration-test groupsStatic read of the diff (I can't run the server, so treat as strong hypotheses — CI on a fix confirms): Group B — namespace location == table location → const String location = metadata_content->getValue<String>("location"); // FULL table location
createNamespaceIfNotExists(namespace_name, location); // ...used as the NAMESPACE location
Group A — void IcebergMetadata::drop(bool delete_data)
{
if (!delete_data)
return; // always taken -> nothing purgedThe delete logic below (
Happy to implement both fixes (Group A/B) and take a shot at Group 3 (export-partition snapshot carry-over) — say the word and whether you want a |
`IcebergMetadata::drop` passed `table_path` to `listFiles` as both the path and the prefix, and `listFiles` joins the two, so it listed `table_path/table_path`. The listing came back empty and `data_lake_delete_data_on_drop` deleted nothing whenever the table path is relative to the bucket root, as it is for `IcebergS3`. It only worked for `IcebergLocal`, whose path is absolute and therefore replaces the joined prefix, which is also the only case the test covered. Run `test_drop_honours_query_level_delete_data_on_drop` over `s3` too. (cherry picked from commit 9a4e9cf)
Cherry-picked from ClickHouse#98670.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Supports
CREATE TABLE,CREATE TABLE … AS source, andDROP TABLEforDataLakeCatalog;DROP TABLEcan request catalog-side data purge via the newdata_lake_delete_data_on_dropsettingCI/CD Options
Exclude tests:
Regression jobs to run: