Gabriel39 opened a new pull request, #70967:
URL: https://github.com/apache/doris/pull/70967
### Background
Iceberg REST catalogs can either unregister a table or also delete its data
and metadata files. Doris currently requests file deletion on every table drop,
including table drops performed by `DROP DATABASE FORCE`. A REST service can
forbid purge requests while allowing tables to be unregistered.
### What problem does this PR solve?
Issue Number: None
Related PR: #43441 (introduced always-purge table drops)
PR Type: Bugfix
Problem Summary:
`DROP TABLE` fails against REST services that reject purge requests, with no
way to request unregister-only behavior. Add the REST catalog property
`iceberg.rest.drop-with-purge-enabled`, configurable through CREATE/ALTER
CATALOG and defaulting to `true`. Setting it to `false` also covers the table
cascade of `DROP DATABASE FORCE`; most of this diff tests both modes and checks
physical file retention. Existing users retain the current behavior unless they
disable purge.
```sql
ALTER CATALOG rest_catalog SET PROPERTIES (
"iceberg.rest.drop-with-purge-enabled" = "false"
);
DROP TABLE rest_catalog.db.events;
```
### Details
- **Change map:** 34 changed production lines bind, validate and apply the
option; 358 test lines cover REST requests, compatibility, errors and physical
objects; 21 generated expectation lines record SQL results.
- **Frequency:** Always when a REST service rejects `purgeRequested=true`;
reproduced with a local REST server returning HTTP 403.
- **Root cause:** `IcebergConnectorMetadata.dropTable` and the force path in
`dropDatabase` unconditionally pass `true` to `catalogOps.dropTable`, so the
Iceberg SDK always requests purge.
- **Why existing tests missed it:** `IcebergConnectorMetadataDdlTest`
asserts the existing purge behavior using recording catalog operations. The
`iceberg_drop_rest_table` and `test_iceberg_drop_db` regressions check
successful purging and privileges, without an unregister-only mode or a server
rejecting purge. The new tests check the actual REST query and retained data,
metadata, manifests and manifest lists.
- **Fix:** Resolve the option at DROP time for REST catalogs, and pass the
same value through direct and cascaded table drops. Invalid booleans are
rejected during CREATE/ALTER validation, without adding validation to replay
binding.
- **Other paths and branches:** Both table-drop routes are fixed here; view
drops and non-REST semantics remain unchanged. In particular, HadoopCatalog may
delete its directory even with `purge=false`. Local snapshots of branches 3.1,
4.0, 4.1 and 4.2 have the same hardcoded purge behavior in the legacy metadata
implementation and need an adapted backport. The always-purge table behavior
was introduced by #43441; this PR preserves that default.
- **Configs and defaults:** `iceberg.rest.drop-with-purge-enabled=true` by
default. ALTER CATALOG changes subsequent drops without an FE restart. With
`false`, REST drops unregister tables and leave their files in storage.
- **Behavior change:** Only REST catalogs explicitly setting the option to
`false` change their drop behavior. SQL FORCE retains its existing cascade
meaning.
### Testing
- Before the fix, four of six initial `IcebergRestDropPurgeTest` cases
failed, including the HTTP 403 reproduction. All seven final cases pass,
including failure propagation and non-REST compatibility.
- Focused local unit run: 70 tests passed across the REST property, DDL and
new DROP suites.
- Broader Iceberg connector package run: 2,063 tests, zero failures/errors,
ten existing skips; the metastore tests also pass.
- Local regression `test_iceberg_rest_drop_purge_option` passes with the
current FE build and REST/MinIO fixture. Its generated expectations were
checked by a second run. Checks cover default/explicit purge, unregister-only
table and database drops, ALTER validation and exact object presence.
- Full FE build, connector FE Checkstyle and `git diff --check` pass. A live
Polaris deployment was not used.
### Release note
Allow Iceberg REST catalogs to unregister tables without deleting their
files by setting `iceberg.rest.drop-with-purge-enabled=false`. The option also
applies to `DROP DATABASE FORCE` and defaults to `true` for compatibility.
### Check List (For Author)
- Behavior changed: Yes (see Details)
- Does this need documentation: Yes (add the property to the Iceberg REST
catalog configuration documentation after the option naming is reviewed)
- Pre-submission status: Partially verified: live Polaris integration was
not run
### AI Disclosure
- Tool: Codex (GPT-6)
- Generated: implementation, unit and regression tests, and this description
- Human review: Not stated by the author; the agent completed a local
self-review before committing.
- Prompts: Asked to fix REST DROP behavior on master with sufficient unit
and regression coverage, and to complete local review and resolve findings
before submitting code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]