markhoerth commented on code in PR #11152: URL: https://github.com/apache/gravitino/pull/11152#discussion_r3271581118
########## design-docs/async-iceberg-rest-hard-deletion.md: ########## @@ -0,0 +1,421 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +# Design: Pluggable Asynchronous Hard Deletion for the Gravitino Iceberg REST Server + +| Field | Value | +| -------- | ------------------------------------------------------- | +| Status | Draft | +| Authors | @roryqi | +| Created | 2026-05-19 | +| Module | `iceberg/iceberg-rest-server`, `iceberg/iceberg-common` | + +--- + +## 1. Background + +When a client issues: + +``` +DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table}?purgeRequested=true +``` + +today's path is fully synchronous: `IcebergTableOperations.dropTable` → +`IcebergTableOperationExecutor.dropTable` → `IcebergCatalogWrapper.purgeTable` +→ `CatalogHandlers.purgeTable`, which walks every snapshot / manifest / +data file and deletes each one through `FileIO` on the Jetty request +thread. + +For production tables this fails in three ways: + +- Multi-minute purges exceed HTTP timeouts. +- Concurrent purges saturate the Jetty pool. +- Mid-purge failures leak files with no retry or audit trail. + +We want to return quickly, finish deletion reliably in the background, +survive restarts, and let operators plug in alternative strategies +(object-store batch APIs, external job systems, audit-only) without +modifying Gravitino. + +*Not in scope:* `RelationalGarbageCollector`, which deletes tombstoned +**rows** from Gravitino's relational backend. Different IO surface, +different failure model — kept separate. + +## 2. Goals + +1. `DELETE … ?purgeRequested=true` returns at typical request latency + (target p99 < 500 ms) regardless of table size, when an async purger + is configured. +2. File-deletion strategy is **pluggable** behind an `IcebergPurger` SPI. +3. The default async implementation deletes every file the synchronous + purge would have deleted, retries transient failures, and survives + restarts. +4. No change to the Iceberg REST wire protocol. +5. Authorization runs on the **request thread**, never deferred. + +## 3. Non-Goals + +- Changing Gravitino-native soft-delete semantics. Review Comment: The PRD has soft delete (R2) as the next requirement after async hard delete, built on the same row, executor, and scheduler that R1 introduces. Listing it as a non-goal here is fine for implementation order, but the row removal in §6.1 (see my comment on §9) makes recovery impossible. Once the row is gone, there's nothing to undrop from. Under this design R2 becomes a separate mechanism in V2 instead of a small extension on V1, which slips the migration story for Snowflake and Unity customers out of 1.3. -- 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]
