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

   ### What changes were proposed in this pull request?
   
   - `CaffeineEntityCache`: build the cache with `expireAfterWrite` instead of 
`expireAfterAccess`.
   - `Configs.CACHE_EXPIRATION_TIME`: fix a missing space in the doc string.
   - `docs/gravitino-server-config.md`: state that the TTL clock starts at 
write time and is not reset by reads, so `expireTimeInMs` is also the upper 
bound on stale reads in a multi-node deployment if a cross-node invalidation is 
ever missed.
   - New `TestCaffeineEntityCacheExpiration` asserting the Caffeine policy is 
write-based (and absent when the TTL is `0`).
   
   ### Why are the changes needed?
   
   `gravitino.cache.expireTimeInMs` and the docs both describe a TTL measured 
from the write, but the implementation used `expireAfterAccess`. With an 
access-based TTL, an entry that keeps being read never expires, so a single 
missed cross-node invalidation (lost `entity_change_log` row, stalled poller) 
becomes permanent staleness on exactly the hottest keys. A write-based TTL 
bounds that to `expireTimeInMs`.
   
   This is item 1 of #12377; the other items are left for follow-ups.
   
   Fix: #12377
   
   ### Does this PR introduce _any_ user-facing change?
   
   Behaviour change only: entries now expire `expireTimeInMs` after they were 
written, regardless of reads. Hot entries are reloaded from the DB once per TTL 
(default 1 hour). No config keys added or removed.
   
   ### How was this patch tested?
   
   `TestCaffeineEntityCacheExpiration` (new), plus the existing 
`org.apache.gravitino.cache.*` and `TestEntityCache*` unit tests.
   
   https://claude.ai/code/session_015v8chvQJLYFBuBv1MiHebo
   


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