laserninja opened a new pull request, #12869:
URL: https://github.com/apache/gravitino/pull/12869
### What changes were proposed in this pull request?
Move the entity-store lookup in `MetadataAuthzHelper.preloadOwner` inside
its existing `try` block.
### Why are the changes needed?
`preloadOwner` is a best-effort cache warm-up - its `catch (Exception e)`
logs and ignores any failure. But `GravitinoEnv.getInstance().entityStore()`
was called *outside* the `try`, and that method throws
`IllegalArgumentException("GravitinoEnv is not initialized.")`. The exception
therefore escaped the warm-up, propagated out of `filterByExpression`, and
failed the entire list request with a 400.
This already breaks three tests in `server`, which return 400 instead of 200:
```
Failed to operate tag(s) operation [LIST] under object [...], reason
[GravitinoEnv is not initialized.]
at org.apache.gravitino.GravitinoEnv.entityStore(GravitinoEnv.java:261)
at
org.apache.gravitino.server.authorization.MetadataAuthzHelper.preloadOwner(MetadataAuthzHelper.java:552)
at
org.apache.gravitino.server.authorization.MetadataAuthzHelper.filterByExpression(MetadataAuthzHelper.java:364)
```
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
```bash
./gradlew :server:test :server-common:test -PskipITs
```
`:server:test` goes from 3 failures to 0 (323 tests).
`TestMetadataObjectTagOperations#testListTagsForObject`,
`#testListTagsForObjectUnderHierarchicalSchema`, and
`#testListTagsDeduplicatesDifferentAssignmentValues` pass again.
--
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]