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

   ### What changes were proposed in this pull request?
   
   When `EntityAlreadyExistsException` is raised during schema/table/view 
import, catch it and reuse the existing entity instead of throwing 
`UnsupportedOperationException`.
   
   Changed the `catch (EntityAlreadyExistsException)` blocks in:
   - `SchemaOperationDispatcher.importSchema()` — log warning and return
   - `TableOperationDispatcher.importTable()` — log warning and reload via 
`internalLoadTable()`
   - `ViewOperationDispatcher.importView()` — log warning and reload via 
`internalLoadView()`
   
   ### Why are the changes needed?
   
   In HA deployments with multiple Gravitino nodes, concurrent imports of the 
same entity fail because `TreeLock` is JVM-local and does not prevent 
cross-node races. The current behavior throws 
`UnsupportedOperationException("... managed by multiple catalogs...")`, which 
is incorrect for the concurrent-import case — the entity is managed by the same 
catalog, just imported by another node first.
   
   Fixes #11040
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Concurrent import requests that previously failed with 
`UnsupportedOperationException` now succeed.
   
   ### How was this patch tested?
   
   Added unit tests for each dispatcher:
   - `TestSchemaOperationDispatcher.testLoadSchemaConcurrentImport()`
   - `TestTableOperationDispatcher.testLoadTableConcurrentImport()`
   - `TestViewOperationDispatcher.testLoadViewConcurrentImport()`
   
   Each test mocks `store.put()` to throw `EntityAlreadyExistsException` and 
verifies that the load operation succeeds without exception.


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