LiJie20190102 commented on PR #13094:
URL: https://github.com/apache/gravitino/pull/13094#issuecomment-5641853252

   @yuqi1129  While investigating the schema cascade delete fix in this PR, I 
noticed that **catalog and metalake cascade deletes have the same 
`table_version_info` orphan-row issue** — they soft-delete `table_meta` rows 
but never clean up the corresponding `table_version_info` rows.
   
   **What I found:**
   
   All other version tables (`fileset_version_info`, `function_version_meta`, 
`view_version_info`, `model_version_meta`) have three levels of cascade cleanup 
methods:
   - `softDeleteXxxVersionsBySchemaIds` (schema level)
   - `softDeleteXxxVersionsByCatalogId` (catalog level)
   - `softDeleteXxxVersionsByMetalakeId` (metalake level)
   
   But `table_version_info` only has the schema-level method 
(`softDeleteTableVersionsBySchemaIds`, added in this PR). The catalog-level and 
metalake-level methods **do not exist**:
   
   | Version table | By schema IDs | By catalog ID | By metalake ID |
   |---|---|---|---|
   | `fileset_version_info` | ✅ | ✅ | ✅ |
   | `function_version_meta` | ✅ | ✅ | ✅ |
   | `view_version_info` | ✅ | ✅ | ✅ |
   | `model_version_meta` | ✅ | ✅ | ✅ |
   | **`table_version_info`** | ✅ *(this PR)* | ❌ missing | ❌ missing |
   
   **Impact:**
   
   When a catalog or metalake is cascade-deleted, all `table_meta` rows are 
soft-deleted, but their `table_version_info` rows remain active (`deleted_at = 
0`) — permanently orphaned. The legacy-timeline GC won't reclaim them either, 
since it only purges rows where `deleted_at > 0`.
   
   **Scope:**
   
   This PR focuses on the schema-level cascade race condition (#12406). The 
catalog/metalake gap looks like a pre-existing bug of the same class. I think 
it's cleaner to track it in a separate follow-up issue rather than expand this 
PR's scope. Let me know if you'd prefer to address it here instead.


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