Skip to content

[fix](iceberg) [branch-4.1] Allow REST table drops without purging files - #71010

Open
Gabriel39 wants to merge 1 commit into
apache:branch-4.1from
Gabriel39:fix/iceberg-rest-drop-purge-4.1
Open

Gabriel39 wants to merge 1 commit into
apache:branch-4.1from
Gabriel39:fix/iceberg-rest-drop-purge-4.1

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None
Related PR: #70967
PR Type: Bugfix

Adapt #70967 at 08e925bb3af62d6bea8563ee5cbc251f16e0b078 (including both commits) to branch-4.1.

Iceberg REST services can reject purge requests while allowing tables to be unregistered. Add iceberg.rest.drop-with-purge-enabled, defaulting to true. Setting it to false unregisters tables while retaining their data and metadata files, including table drops performed by DROP DATABASE FORCE.

Details

  • Adapt the connector-based implementation to the release branch's IcebergRestProperties, IcebergExternalCatalog and IcebergMetadataOps APIs.
  • Validate the boolean on CREATE/ALTER statements without adding validation to replay property binding.
  • Apply the REST-only choice in the shared table-drop path used by direct DROP and forced database cascades. Preserve view drops, error propagation and non-REST behavior.
  • Carry over both regression commits, including physical object checks and cleanup of previous-run retained objects. Adapt unit coverage to the legacy metadata interfaces.

Testing

  • Repository run-fe-ut.sh compiles the target FE and passes 114 tests across the DROP, REST property and legacy metadata suites; 3 pre-existing disabled integration tests are skipped. Zero failures or errors.
  • Baseline tests reproduced the always-purge REST request, HTTP 403 and missing boolean validation before the fix. The adapted DROP suite passes all eight tests afterward.
  • FE Checkstyle, Groovy syntax, diff whitespace checks (allowing generated result EOF separators), full diff self-review and sensitive-information checks pass.
  • Both regression file blobs match the source PR's final revision exactly, including its repeated-run object cleanup.
  • SQL integration regression and live Polaris were not rerun on this target branch; that coverage remains for CI.

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.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70967
PR Type: Bugfix

Adapt apache#70967 at `08e925bb3af62d6bea8563ee5cbc251f16e0b078` (including both commits) to `branch-4.1`.

Iceberg REST services can reject purge requests while allowing tables to be unregistered. Add `iceberg.rest.drop-with-purge-enabled`, defaulting to `true`. Setting it to `false` unregisters tables while retaining their data and metadata files, including table drops performed by `DROP DATABASE FORCE`.

### Details

- Adapt the connector-based implementation to the release branch's `IcebergRestProperties`, `IcebergExternalCatalog` and `IcebergMetadataOps` APIs.
- Validate the boolean on CREATE/ALTER statements without adding validation to replay property binding.
- Apply the REST-only choice in the shared table-drop path used by direct DROP and forced database cascades. Preserve view drops, error propagation and non-REST behavior.
- Carry over both regression commits, including physical object checks and cleanup of previous-run retained objects. Adapt unit coverage to the legacy metadata interfaces.

### Testing

- Repository `run-fe-ut.sh` compiles the target FE and passes 114 tests across the DROP, REST property and legacy metadata suites; 3 pre-existing disabled integration tests are skipped. Zero failures or errors.
- Baseline tests reproduced the always-purge REST request, HTTP 403 and missing boolean validation before the fix. The adapted DROP suite passes all eight tests afterward.
- FE Checkstyle, Groovy syntax, diff whitespace checks (allowing generated result EOF separators), full diff self-review and sensitive-information checks pass.
- Both regression file blobs match the source PR's final revision exactly, including its repeated-run object cleanup.
- SQL integration regression and live Polaris were not rerun on this target branch; that coverage remains for CI.

### 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.
@Gabriel39
Gabriel39 requested a review from yiguolei as a code owner November 25, 2026 06:37
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all six changed files at faeef05 and the related CREATE/ALTER, replay, catalog-generation, authentication and table/view drop flows. No new actionable findings and no existing blocking inline findings were identified. Review converged in round 1: both complete-scope reviewers and the separate risk reviewer returned NO_NEW_VALUABLE_FINDINGS, and the main reviewer independently checked their evidence and completed the final sweep.

Critical checkpoint conclusions:

  1. Goal: REST catalogs can select unregister-only table drops with iceberg.rest.drop-with-purge-enabled=false; the absent option preserves purge=true. Direct DROP TABLE and DROP DATABASE FORCE share the decision.
  2. Scope: the three production changes are focused on the property, statement validation and shared drop policy.
  3. Concurrency: the immutable operations property snapshot stays paired with its SDK client. ALTER publication/reset and operation admission use the same catalog monitor; generation checks reject stale operations. No new locks or external IO under locks are introduced.
  4. Lifecycle: existing generation leases retain in-flight clients through reset. The new fields introduce no resource ownership or cross-translation-unit initialization dependency. HTTP and S3 test resources have cleanup paths.
  5. Configuration: CREATE and detached ALTER validation accept true/false case-insensitively and reject invalid values before publication; successful ALTER resets the runtime without restart.
  6. Compatibility: the missing property retains prior behavior; existing catalog property maps and journal formats are unchanged. Replay avoids the new statement-time validation, and property binding remains lenient. No storage-format or function-symbol changes occur.
  7. Shared definitions: no Thrift/protobuf definitions changed, so release-branch definition comparison is inapplicable.
  8. Parallel paths: direct and forced table drops use the same helper; views retain their separate drop path. Non-REST flavors retain purge=true, including their existing unsupported-DDL restrictions.
  9. Conditions: the REST-only condition and Hadoop directory-deletion comment explain the restriction. Valid boolean parsing and catalog subtype validation are consistent.
  10. Coverage: inspected eight JUnit cases covering defaults, explicit options, non-REST catalogs, validation, views, aborted cascades and actual REST request shape. The regression covers ALTER, direct/cascading drops, physical data/metadata/manifest retention and deletion, and repeated-run cleanup isolation.
  11. Expected results: all eight regression output sections match the queries and their order; row queries are deterministic and the SHOW queries expect empty results. Generation provenance of the .out file was not independently established.
  12. Observability: existing table/database error context and drop/cascade logs cover the selected SDK operations; this change adds no new distributed stage requiring separate instrumentation.
  13. Persistence/failover: the option follows existing catalog-map journaling and replay; no new durable state or transaction protocol is introduced.
  14. Data mutation: the intended change is the explicit SDK purge argument. Existing exception propagation stops failed cascades; remote mutation, cache retirement and journal ordering are unchanged.
  15. FE/BE propagation: no new transmitted variables or sending paths are involved.
  16. Performance: the decision adds fixed map/string operations without additional remote calls or collection allocation.
  17. Other invariants: no new visible-version, delete-bitmap, committed-row visibility, memory-ownership or error-swallowing issue was found.

Risk dispositions: ALTER/generation consistency, REST dispatch/non-REST isolation, and physical-object test cleanup were dismissed with concrete code evidence. There were no additional user focus points and no existing inline threads. No unresolved code candidates or uncovered changed files remain.

Validation limits: static inspection only. No builds, unit/regression tests, live Polaris requests, runtime concurrency or failover experiments were executed. Source files and submodules were left untouched; reported PR test runs were not independently reproduced.

Review converged after 1 round(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant