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

   ### What changes were proposed in this pull request?
   
   Restrict `CaffeineEntityCache` to an explicit allowlist of self-contained 
entity types, replacing the previous exclude-list of `{USER, GROUP, ROLE}`.
   
   - `CACHEABLE_TYPES = {METALAKE, CATALOG, SCHEMA, TABLE, TOPIC, VIEW, 
FILESET, TAG, POLICY, JOB}`; `put()` skips any type not in the allowlist, so 
reads for other types fall through to the `EntityStore`.
   - Model, model version, and function are no longer cached: each carries a 
load-bearing pointer (a version URI, the latest version, the function 
implementation) that would be silently wrong if served stale on another node.
   - Removed the now-dead `invalidateOnKeyChange` model-version → model branch 
(every cacheable entity is self-contained, so inserting one never invalidates a 
different key), dropped the unused imports, and updated the class javadoc.
   - Tests: replaced `testPutModelVersionInvalidatesModel` with 
`testModelAndModelVersionAreNotCached`; added `testTagIsCached`.
   
   Stacked on #12006; please merge after it.
   
   ### Why are the changes needed?
   
   With relation caching removed (#11961) the cache holds only single-entity 
entries, but not every type is safe to serve from a per-node copy. Types whose 
value embeds a load-bearing pointer (model / model version URI and latest 
version, function implementation) would return a silently wrong answer on a 
node with a stale copy; relation-derived types (user/group/role) cannot be 
invalidated without a reverse index. An explicit allowlist keeps only the 
self-contained types that are safe per node, and makes any newly added type 
default to not-cached. Prerequisite for the cross-node invalidation work under 
#11737.
   
   Fix: #12018
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Internal caching behavior only; uncached types are read straight from 
the `EntityStore`, so results are unchanged.
   
   ### How was this patch tested?
   
   - `./gradlew :core:test --tests "org.apache.gravitino.cache.*"` — all pass, 
including the new `testModelAndModelVersionAreNotCached` and `testTagIsCached`.
   - `TestRelationalEntityStore` (4/4) and the H2 matrix of 
`TestEntityStorageRelationCache` 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]

Reply via email to