Skip to content

Make iceberg_delete_data_on_drop use query context - #126110

Merged
asya-ch merged 2 commits into
masterfrom
asya/drop_fix
Oct 16, 2026
Merged

asya-ch merged 2 commits into
masterfrom
asya/drop_fix

Conversation

@asya-ch

@asya-ch asya-ch commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #124481

Summary

SET iceberg_delete_data_on_drop = 1 had no effect on DROP TABLE in a DataLakeCatalog database. The setting was read from the global context only. Such a drop runs inside the query, so the query settings apply. A table of an Atomic database is still dropped by a background thread without a query context, and keeps reading the global context.

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 into CHANGELOG.md):

DROP TABLE in a DataLakeCatalog database now respects the query-level setting iceberg_delete_data_on_drop.


Workflow [PR]
Sync PR [sync-upstream/pr/126110]

Version info

  • Merged into: 26.11.1.107-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4b7aae7]

Summary: ✅


AI Review

Summary

DROP TABLE in a DataLakeCatalog database now reads iceberg_delete_data_on_drop from the query context through a shared helper for StorageObjectStorage and StorageObjectStorageCluster. Background Atomic cleanup continues to use the global context. The added regression covers retaining and purging table files. No actionable findings remain; the three earlier findings were addressed by reverting the storage-side purge changes, and their threads have been resolved.

Missing context / blind spots
  • ⚠️ Runtime validation was not independently confirmed: the head Praktika report exposed no per-test integration results, and no local tests were run. A passing run of test_database_iceberg/test.py::test_drop_table_purge_query_setting would close this gap.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Oct 15, 2026
@asya-ch

asya-ch commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

The scope is creeping :). Turns out deleting data is not super safely implemented, because we're supposed to traverse the metadata tree, not delete the whole directory contents. Now, it is blocked, but it's not super obvious how to fix at this point. I will switch this PR to just fixing the query context.

Keep only the context fix: `DROP TABLE` in a `DataLakeCatalog` database
now reads `iceberg_delete_data_on_drop` from the query. Revert the
storage-side purge changes. They turned a dead code path into a live one
that deleted every object under the queried directory, which is unsafe
for a directory shared by several tables. The storage-side purge is left
as it was and tracked separately.

Review: #126110

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@asya-ch asya-ch changed the title Fix iceberg_delete_data_on_drop not deleting the table data Make iceberg_delete_data_on_drop use query context Oct 16, 2026
@Diskein Diskein self-assigned this Oct 16, 2026
@asya-ch
asya-ch added this pull request to the merge queue Oct 16, 2026
Merged via the queue into master with commit 3a62a05 Oct 16, 2026
353 of 354 checks passed
@asya-ch
asya-ch deleted the asya/drop_fix branch October 16, 2026 20:30
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants