smengcl commented on code in PR #373:
URL: https://github.com/apache/ozone-site/pull/373#discussion_r3077212850


##########
docs/07-system-internals/07-features/03-bucket-snapshot-deletion-lifecycle.md:
##########
@@ -0,0 +1,51 @@
+---
+sidebar_label: Snapshot Deletion Lifecycle
+---
+
+# Snapshot Deletion Lifecycle
+
+This document describes the internal lifecycle of snapshot deletion in Apache 
Ozone, from the initial user request to the final physical removal of data and 
metadata.
+
+The snapshot deletion process is divided into four main phases:
+
+## 1. Request Phase: `OMSnapshotDeleteRequest`
+
+*   **Trigger:** User executes the command `ozone sh snapshot delete <bucket> 
<snapshot>`.
+*   **Operation:** 
+    *   The Ozone Manager (OM) receives the request and validates it.
+    *   The snapshot's status is updated to `SNAPSHOT_DELETED` in the 
`SnapshotInfoTable`.
+    *   The `deletionTime` is set to the current timestamp.
+*   **Result:** This phase only "labels" the snapshot for deletion. It does 
not yet adjust the snapshot chain or reclaim any data. The snapshot remains in 
the system but is now a candidate for the background reclamation service.
+
+## 2. Reclamation Phase: `SnapshotDeletingService`
+
+*   **Trigger:** A background service that runs periodically.
+*   **Operation:** 
+    *   The service identifies snapshots with the `SNAPSHOT_DELETED` status.
+    *   It processes the deleted snapshot's internal tracking tables: 
`deletedTable`, `deletedDirTable`, and `renamedTable`.
+    *   **Data Moving:** It moves entries from these tables to either:
+        1.  The **next active snapshot** in the chain (if one exists).
+        2.  The **Active Object Store (AOS)** (the main bucket) if no 
subsequent snapshot exists.
+*   **Settling:** Once all keys and directories for the snapshot have been 
successfully moved (i.e., the snapshot's deleted tables are empty), the service 
collects the snapshot's DB key into a "purge list".
+
+## 3. Finalization Phase: `OMSnapshotPurgeRequest`
+
+*   **Trigger:** Triggered by the `SnapshotDeletingService` once a snapshot is 
fully "empty" (all keys reclaimed).
+*   **Chain Adjustment (The Surgeon):** This is where the actual snapshot 
chain surgery occurs. The service updates the `previousSnapshotId` of the next 
snapshot in the chain to point to the deleted snapshot's predecessor, 
effectively "stitching" the chain back together.

Review Comment:
   Not sure where `The Surgeon` comes from :) Was it in the prompt? or the 
agent just came up with it?



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

Reply via email to