Mykal-Steele opened a new pull request, #10616:
URL: https://github.com/apache/gravitino/pull/10616

   [#10601] fix(core): add catalog rollback on partial metalake failure
   
   ### What changes were proposed in this pull request?
   
   I added a rollback step in `MetalakeManager.enableMetalake()` and 
`disableMetalake()`. Now if the catalog updates throw err halfway through, we 
catch the exception and call `updateMetalakeInUseStatusInCatalog` again with 
the opposite boolean value to undo what we already changed. To we don't leave 
things in a half-broken state
   
   ### Why are the changes needed?
   
   Right now, if you enable or disable a metalake and one of the catalog 
updates fails, the main storage rolls back fine, but the catalogs that already 
got updated are left with the wrong `metalake-in-use` status. So you end up 
with an inconsistent state. This fixes it so the catalogs roll back too
   
   Fixes #10601
   
   ### Does this PR introduce _any_ user-facing change?
   
   Nope
   
   ### How was this patch tested?
   
   Added a new unit test called 
`testEnableMetalakeShouldRollbackWhenCatalogPropagationFails` in 
`TestMetalakeManager.java`. Same test as the one provided in the issue, but 
added explicit verify checks to make sure `setMetalakeInUseStatus` is called 
with the correct boolean flags.
   


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