Description
Use caffeine as backingmap, saw possible inconsistency after evict entry from cache
The cache setup as following
instead of use it directly as shown in the document, added caffeine inside read-write-backing-map, as I will need to integrate cache-store
<scheme-name>caffeine-distributed-scheme</scheme-name>
<backing-map-scheme>
<read-write-backing-map-scheme>
<internal-cache-scheme>
<caffeine-scheme />
</internal-cache-scheme>
<cachestore-scheme />
</read-write-backing-map-scheme>
</backing-map-scheme>
A dummy cacheloader is used, which will throw exception when accessed, this is used for simply show the problem
Insert data into cache normally
evict cache right before issue cache.clear
the evict will eventually call this line
and it seems CaffeineCache will record the eviction but may not synchronously finish the operation
then the cache clear will hit this line
which will return the keys including the key just evicted
code following this will try to remove key one by one, and found the evicted key already gone from cache, then it will try to reload it from cache loader, which will trigger the exception from dummy cache loader
Is this intended behavior? main concern here is if there will be more cases we will see the inconsistency, causing more troubles
Environment (please complete the following information):
- Coherence 14.1.2.0.1
- Java 21 zulu
- OS: linux
- OS redhat 7
- Is this a container/cloud environment, no