nevzheng opened a new pull request, #14264:
URL: https://github.com/apache/gravitino/pull/14264

   ### What changes were proposed in this pull request?
   
   - **`IcebergTableOperationExecutor#dropTable` builds the async purge job 
before the backend drop.** The
     catalog id, metadata location and FileIO settings are resolved first, so a 
failure there stops the
     request before anything is changed.
   - **After the drop, an enqueue failure is logged at ERROR** with the 
metadata location, and the drop
     succeeds.
   
   ### Why are the changes needed?
   
   **Async purge could fail a drop that had already committed.** The catalog id 
lookup and the job insert
   ran after the backend drop. A failure there returned 500 for a table that 
was gone, emitted a drop
   failure event, and skipped the hook's entity cleanup, so the Gravitino 
entity and its grants stayed for
   the next table under that name.
   
   Fix: #14263
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A drop with async purge no longer returns 500 after the table is gone. 
If the cleanup job cannot
   be enqueued, the data files are left in place and their metadata location is 
logged at ERROR.
   
   ### How was this patch tested?
   
   | Test | `main` | Fix |
   |---|---|---|
   | `TestIcebergAsyncPurge#testAsyncDropResolvesCatalogIdBeforeBackendDrop` | 
fail | pass |
   | 
`TestIcebergAsyncPurge#testAsyncDropEnqueueFailureAfterBackendDropDoesNotFailRequest`
 | fail | pass |
   | 
`TestIcebergTableHookDispatcher#testAsyncPurgeEnqueueFailureStillCleansUpEntity`
 | fail | pass |
   
   With the fix, `TestIcebergAsyncPurge` (10) and 
`TestIcebergTableHookDispatcher` (19) pass, including
   the unchanged `testAsyncDropEnqueuesJob` order check, as do the view and 
namespace hook suites,
   `TestIcebergTableOperationExecutor` and `TestRESTService`.
   
   `./gradlew -PskipITs :iceberg:iceberg-rest-server:test --tests 
'*TestIcebergAsyncPurge' --tests '*TestIcebergTableHookDispatcher'`
   
   An inline file delete as a fallback is possible, but it would block the 
request thread, so it is left
   out.
   


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