nevzheng opened a new issue, #14263:
URL: https://github.com/apache/gravitino/issues/14263
### Version
main branch
### Describe what's wrong
With async purge (`X-Gravitino-Async-Purge: true`),
`IcebergTableOperationExecutor#dropTable` with `purgeRequested=true` drops
the table from the backend first, then resolves the catalog id and enqueues
an `IcebergCleanupJob`.
Both of those steps can throw (`IcebergCleanupHelper.catalogId`,
`IcebergCleanupManager#addJob`).
When one throws after the drop:
- **The client gets 500 for a drop that committed**, and a retry gets 404.
- **The hook skips its cleanup.** The exception leaves
`IcebergTableHookDispatcher#dropTable` before
the entity reconcile and orphan-schema cleanup, so the Gravitino entity
and its grants stay. The next
table created under that name can be imported onto the old entity.
- **The event is wrong.** `IcebergDropTableFailureEvent` is emitted for a
table that is gone.
- **The data files leak**, because no job was stored.
Sync purge and plain drop are not affected.
### Error message and/or stacktrace
Client: HTTP 500. Server: the exception from the job store insert or from
the catalog id lookup.
### How to reproduce
1. Run the Iceberg REST server in auxiliary mode with async purge enabled.
2. Make inserts into the cleanup job table fail (for example, revoke INSERT
for the Gravitino database
user).
3. `DELETE /v1/{prefix}/namespaces/s1/tables/t1?purgeRequested=true` with
`X-Gravitino-Async-Purge: true`.
Expected: 204, with the entity removed as for a sync purge, and the enqueue
failure logged.
Actual: 500. The table is gone from the backend, but the Gravitino entity
stays.
### Additional context
Proposed fix: resolve the catalog id and build the job before the backend
drop, so a failure there
stops the request before anything is changed. After the drop, log an enqueue
failure at ERROR with the
metadata location and let the drop succeed.
--
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]