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

   ### What changes were proposed in this pull request?
   
   The 5-arg default `registerModel` now rolls back best-effort when version 
linking fails: it removes the model only if it still has zero versions (since 
`deleteModel` cascades to all versions and another actor may have linked one 
concurrently), then rethrows the original exception. The javadoc documents the 
conditional rollback and the non-atomic check-and-delete window.
   
   ### Why are the changes needed?
   
   A `linkModelVersion` failure previously left an orphan model with zero 
versions, and a retry of the registration then failed with 
`ModelAlreadyExistsException`.
   
   Fix: #13224
   
   ### Does this PR introduce _any_ user-facing change?
   
   No API change. On a version-linking failure, the default `registerModel` no 
longer leaves an orphan model behind and rethrows the original exception. The 
rollback is best-effort and non-atomic, as documented in the javadoc.
   
   ### How was this patch tested?
   
   Added `TestModelCatalog`, which pins that a `linkModelVersion` failure 
removes the model when it has zero versions and rethrows the original 
exception, and that it does not delete a model to which another actor has since 
linked a version; it fails on the pre-fix tree (orphan model left behind) and 
passes after the fix.
   


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