yuqi1129 opened a new pull request, #10996: URL: https://github.com/apache/gravitino/pull/10996
> ⚠️ **Stacked on #10914**. Reviewers: please review only the commit `889059926` (top of branch). The diff vs `main` will go away once #10914 lands. ### What changes were proposed in this pull request? This is the final piece of the #10812 split. It rewrites `JcasbinAuthorizer`'s caching layer: - **Per-request dedup** via `AuthorizationRequestContext`: user identity, name→id, and owner lookups are deduplicated within a single HTTP request. - **Version-validated shared caches** (`userRoleCache`, `loadedRoles`): cache hits revalidate against `user_meta.updated_at` / `role_meta.updated_at` before being trusted, replacing TTL-only invalidation. - **Eventual-consistency caches** (`metadataIdCache`, `ownerRelCache`): driven by a scheduled poller that drains `entity_change_log` (ALTER/DROP) and `owner_meta` change rows, invalidating exactly the affected cache keys on HA peers. - **`GravitinoCache` abstraction**: `Caffeine` and `NoOps` implementations so caches can be disabled or swapped without touching call sites. - `isMetalakeUser` now takes `AuthorizationRequestContext` so the per-request `UserUpdatedAt` cache populated by `authorize`/`isOwner` is reused, removing a redundant DB round-trip. ### Why are the changes needed? Fix: #10772 ### Does this PR introduce _any_ user-facing change? No. New configs (`gravitino.authorization.cache.*`) have safe defaults. ### How was this patch tested? - 12 new unit tests added across `TestGravitinoCache` (TTL, max-size eviction, prefix edge cases) and `TestAuthorizationRequestContext` (request-scoped dedup for user/owner/metadata-id, including absent-result caching). - All existing `TestJcasbinAuthorizer`, `TestJcasbinAuthorizerCacheHelpers`, and `TestPassThroughAuthorizer` suites still pass. -- 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]
