yuqi1129 opened a new pull request, #12006: URL: https://github.com/apache/gravitino/pull/12006
### What changes were proposed in this pull request? - Remove relation-list caching from the entity cache: `EntityCache` now extends only `SupportsEntityStoreCache`; `SupportsRelationEntityCache`, `EntityCacheRelationKey`, `ReverseIndexCache` and `ReverseIndexRules` are deleted. - `CaffeineEntityCache` stores one entity per `EntityCacheKey`. The radix prefix index is kept only for hierarchical cascade invalidation, and child matching now uses `identifier + "."` so siblings sharing a name prefix (`catalog1` vs `catalog10`) are no longer evicted together. - `USER` / `GROUP` / `ROLE` entities are no longer cached: their materialized form embeds relation-derived data (securable objects, role names) that only the removed reverse index could keep consistent. - Relation operations in `RelationalEntityStore` (`listEntitiesByRelation`, `batchListEntitiesByRelation`, `getEntityByRelation`) always fall back to the backend; relation writes invalidate the single-entity entries of the identifiers involved. - Update unit tests, jcstress tests and JMH benchmarks accordingly. ### Why are the changes needed? The relation keys, prefix/reverse indexes and bidirectional invalidation made the cache hard to reason about and the SPI nearly impossible to re-implement. Keeping the default cache focused on single-entity entries unblocks the multi-node entity cache work (#11737). APIs that now always hit the DB for relation lists: `TagManager`, `PolicyManager`, `FutureGrantManager`, `RoleManager`, `OwnerManager` (one indexed query per call, same as the previous cache-miss path). Performance validation notes are tracked in the issue. Fix: #11961 ### Does this PR introduce _any_ user-facing change? No API or configuration changes. Behavior change: relation query results and role/user/group entities are no longer served from cache. ### How was this patch tested? - Rewritten `TestCaffeineEntityCacheInvalidation` (hierarchy cascade, sibling-prefix safety, non-cacheable types, model-version invalidation). - Updated `TestEntityStorageRelationCache` to assert store-level freshness (grant/revoke/rename visibility) instead of cache internals; updated `TestRelationalEntityStore`, `TestCacheConfig`, `TestCacheIndex`, `TestEntityCacheKey`. - `./gradlew :core:test -PskipITs` (h2 variants and all cache/storage tests pass; mysql/postgresql parameterized variants fail in `init()` due to local Docker environment, unrelated to this change). -- 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]
