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

   ### What changes were proposed in this pull request?
   
   Add optimistic concurrency control to the complete alter and delete 
operations for metalakes, catalogs, and schemas.
   
   - Increment the entity version on every alter and update rows by id plus the 
expected current version.
   - Delete the root entity by id plus the expected current version before any 
cascade cleanup.
   - For hierarchical schemas, CAS-delete the requested schema first and then 
authoritatively delete its descendants.
   - Report stale alter or delete operations with `OptimisticLockException`.
   
   This PR depends on #12349.
   
   ### Why are the changes needed?
   
   Concurrent metadata changes must not silently overwrite newer state or run 
relationship and descendant cleanup after the root entity CAS fails.
   
   Fix: #12342
   
   ### Does this PR introduce _any_ user-facing change?
   
   Concurrent alter and delete conflicts for metalakes, catalogs, and schemas 
are reported as HTTP 409 through the shared conflict contract from #12349.
   
   ### How was this patch tested?
   
   Added version increment, stale alter, stale delete, and typed conflict 
tests. Ran:
   
   `./gradlew :core:test --tests 
'org.apache.gravitino.storage.relational.utils.TestPOConverters' --tests 
'org.apache.gravitino.storage.relational.service.TestMetalakeMetaService' 
--tests 
'org.apache.gravitino.storage.relational.service.TestCatalogMetaService' 
--tests 'org.apache.gravitino.storage.relational.service.TestSchemaMetaService' 
-PskipITs -PskipDockerTests=true`
   


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