yuqi1129 opened a new issue, #12019:
URL: https://github.com/apache/gravitino/issues/12019

   ### Describe the subtask
   
   Today the entity store cache only invalidates on the node that made the 
change, so other nodes keep serving stale data until their entries expire. This 
subtask makes the default `caffeine` cache correct across nodes by reusing the 
existing `entity_change_log` and `EntityChangeLogPoller` that the jcasbin and 
catalog caches already use, so no new infrastructure is added.
   
   It also adds a coherence marker to the cache SPI so the write path can tell 
a per-node cache (which must be told about changes made on other nodes) from a 
shared cache (which does not). The later Redis implementation relies on the 
same marker.
   
   This subtask should:
   
   - Add `EntityCache.coherence()` returning `LOCAL_PER_NODE | SHARED`, 
implement `LOCAL_PER_NODE` for `CaffeineEntityCache`, and add the write-path 
coherence gate.
   - Add an entity-store `EntityChangeLogListener` that replays each ALTER/DROP 
row as an `invalidate(ident, type)`, with a container drop cascading to cached 
children through the existing forward prefix scan (`cacheIndex`).
   - Register the listener as a third consumer of the existing poller, next to 
the catalog cache and the jcasbin id-mapping cache; no new rows, columns, or 
operate types are needed, since the structural rows already exist.
   - Reuse the lag-safe, id-based polling built for the change log (see #11736) 
and keep the cache TTL as a backstop.
   - Add a multi-node integration test: an ALTER/DROP on node A is reflected on 
node B within one poll interval, a schema drop clears the child tables on the 
other node, and adding the new consumer does not change the two existing ones.
   
   This is the main Phase 1 deliverable of #11737: 
`gravitino.cache.enabled=true` becomes safe in multi-node deployments with the 
default cache.
   
   ### Parent issue
   
   https://github.com/apache/gravitino/issues/11737
   


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