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

   Backport to branch-1.3 of the fix for #14465 (same change as the PR to main; 
it applies cleanly).
   
   ### What changes were proposed in this pull request?
   
   - `IcebergTableHookDispatcher.createTable` holds the namespace's top-level 
tree lock for reading while the table is created, the lock `dropNamespace` 
holds for writing. On one server a create and a drop of the same namespace are 
serialized, so one of them fails. Tree locks are local to a server; across 
replicas the race remains.
   - `IcebergCatalogWrapper.purgeTable` reads the table metadata and FileIO 
first, drops the catalog entry, then calls `CatalogUtil.dropTableData`. If that 
fails on an unreadable file, the new `IcebergPurgeUtil.deleteReachableFiles` 
deletes every data, delete, manifest, manifest list, statistics and metadata 
file it can still reach, skipping what it cannot read. The table's own FileIO 
is used, so any catalog-specific FileIO configuration applies.
   
   ### Why are the changes needed?
   
   Racing requests left a namespace without its properties or owner. A purge 
that met one missing file returned 500 after dropping the table and deleted 
nothing.
   
   Fixes #14465
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A racing drop and create no longer both succeed on one server. A purge 
with a missing manifest list returns success after deleting the reachable files.
   
   ### How was this patch tested?
   
   - 
`TestIcebergTableHookDispatcher#testCreateTableHoldsTheNamespaceBranchLockForReading`.
   - 
`TestIcebergCatalogWrapper#testPurgeDeletesWhatCanBeReadWhenAManifestListIsMissing`,
 on a JDBC (SQLite) catalog with local files: the table is dropped, and the 
data and metadata files still reachable are deleted.
   
   `./gradlew :iceberg:iceberg-common:test :iceberg:iceberg-rest-server:test 
-PskipITs`
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01Eu6fb9pLfmrSJzGQDVLi1g


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