lasdf1234 commented on code in PR #12257:
URL: https://github.com/apache/gravitino/pull/12257#discussion_r3703021542


##########
design-docs/deletion-v2/iceberg-table-soft-deletion.md:
##########
@@ -0,0 +1,479 @@
+<!--
+  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: Soft Deletion for Iceberg Tables
+
+| Field   | Value                                                              
                 |
+| ------- | 
-----------------------------------------------------------------------------------
 |
+| Status  | Draft — for discussion                                             
                 |
+| Author  | Nevin Zheng                                                        
                 |
+| Created | 2026-07-29                                                         
                 |
+| Module  | `core`, `server`, `iceberg/iceberg-rest-server`                    
                 |
+| Related | [Asynchronous Hard 
Deletion](./async-iceberg-rest-hard-deletion.md) (§3 Non-Goal 1) |
+
+**Scope.** The deletion record, the metadata model, and the API for 
discovering and
+undeleting a dropped Iceberg table, and the purge that runs when the window 
closes.
+Purge reuses the shipped cleanup worker; its scheduling and operator tooling 
are
+deferred (§5.6). Existing drop and purge behavior is unchanged.
+
+---
+
+## 1. Background
+
+Dropping an Iceberg table is terminal — no window exists in which a mistaken 
drop
+can be undone.
+
+| Request                                       | What happens                 
                 | Recoverable |
+| --------------------------------------------- | 
--------------------------------------------- | ----------- |
+| `DELETE …` (no purge)                         | Registration removed; data 
files orphaned     | No          |
+| `DELETE …?purgeRequested=true` (synchronous)  | Files deleted on the request 
thread           | No          |
+| `DELETE …?purgeRequested=true` (asynchronous) | A cleanup job deletes files 
in the background | No          |
+
+The asynchronous path shipped with
+[Asynchronous Hard Deletion](./async-iceberg-rest-hard-deletion.md), which 
moved
+cleanup off the request thread. It deliberately left recovery out — its §3 
Non-Goal
+1 destroys files with no undrop path and defers soft delete to a follow-up. 
This is
+that follow-up.
+
+Two existing mechanisms look adjacent but are not recovery. **Relational
+tombstones** (`deleted_at` plus `RelationalGarbageCollector`) are storage 
hygiene:
+nothing reads those rows back, there is no restore verb, and the name frees up 
at
+once. **The purge tombstone** holds an identifier only while a cleanup job 
runs, to
+stop a recreate landing on the old storage prefix.
+
+Gravitino keeps deleted rows and reserves deleted names, yet a user cannot see 
what
+they dropped or get it back. Missing is a durable record saying *this was 
deleted,
+it can still be restored, and here is when that stops being true.*
+
+---
+
+## 2. Goals
+
+1. **Recoverable window**: a dropped table is restorable to its *original* 
identity
+   — same id, name, and attached metadata — until a persisted deadline.
+2. **Bounded**: recoverability ends at that deadline whether or not purge has 
run.
+3. **Reserved name**: the name stays occupied until purge, so no new table can 
take
+   it and make restore ambiguous.
+4. **Discoverable**: users can list what they dropped and how long they have 
left,
+   through the existing Gravitino metadata API.
+5. **No Iceberg REST wire change**: standard clients drop tables exactly as 
today.
+6. **Automatic expiry**: when the window closes, purge removes the files and 
the
+   metadata with no operator action.
+
+---
+
+## 3. Non-Goals
+
+1. **Purge internals**: §5.6 defines the purge lifecycle and its transactions;
+   scheduling parameters, retry tuning, and operator repair tooling are 
deferred.
+2. **Changing existing drop or purge behavior**: the synchronous and 
asynchronous
+   hard-delete paths are untouched, including their defaults and 
`purgeRequested`.
+3. **Non-Iceberg connectors**: JDBC, Kafka, and Paimon drops destroy the 
object at
+   the source. Iceberg is recoverable because a saved metadata pointer can be
+   re-registered.
+4. **Namespace, schema, and view recovery**: different containment rules; a 
follow-up.
+5. **Per-catalog retention**: phase 1 ships one server-level window.
+6. **Trash / recycle-bin UX**: no Web UI work.
+
+---
+
+## 4. Solution Investigations
+

Review Comment:
   The overall design scheme of soft deletion can be presented in a table. The 
table shows the implementation of UC and Polaris, and each row represents a 
different comparison item.



-- 
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]

Reply via email to