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

   ### What changes were proposed in this pull request?
   
   `UserGroupManager.addUser`, `removeUser`, `addGroup`, and `removeGroup` now 
call `MetalakeManager.checkMetalake` on entry, the same check the sibling 
`countUsers`, paginated `listUsers`, and `countGroups` already perform.
   
   ### Why are the changes needed?
   
   These four methods declare `NoSuchMetalakeException`, but nothing on the 
path enforced it: an add or remove against a missing metalake surfaced the 
internal `NoSuchEntityException` from the entity-id lookup, so a caller 
catching the declared type missed it and the 404 carried a generic entity 
message. The check also rejects a not-in-use metalake with 
`MetalakeNotInUseException`, consistent with the sibling methods.
   
   Fix: #13519
   
   ### Does this PR introduce _any_ user-facing change?
   
   Adding or removing a user or group in a missing or disabled metalake now 
returns the documented metalake exception instead of a generic entity error. No 
API or property changes.
   
   ### How was this patch tested?
   
   Added `testAddRemoveUserGroupChecksMetalakeExists`, which asserts all four 
methods throw `NoSuchMetalakeException` for a missing metalake; it fails 
against the pre-fix code, which surfaced `NoSuchEntityException`.


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