[ 
https://issues.apache.org/jira/browse/IGNITE-9315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585787#comment-16585787
 ] 

Stanislav Lukyanov commented on IGNITE-9315:
--------------------------------------------

To avoid the same kind of errors it seems reasonable to simplify the internal 
interface a bit.

In the PR I've added a method `touch(AffinityTopologyVersion topVer)` to the 
`GridCacheEntryEx` which always performs `this.context().evicts().touch(this, 
topVer)`.
I've replaced all calls of `GridCacheEvictionManager::touch` with 
`GridCacheEntryEx::touch`. If we stick to it, there will be no way an entry 
from one cache is passed to another cache's eviction manager.

> Eviction meta from near cache may appear in DHT entries
> -------------------------------------------------------
>
>                 Key: IGNITE-9315
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9315
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Stanislav Lukyanov
>            Assignee: Stanislav Lukyanov
>            Priority: Major
>
> There are cases when eviction metadata from near cache's eviction policy may 
> be added to a DHT cache entry, leading to unpredictable behavior.
> The bug is caused by coding mistakes when a DHT entry is being updated, but 
> near cache entry is being touched.
> E.g. in GridDhtPartitionDemander::preloadEntry:
> {code}
> GridCacheContext cctx = grp.sharedGroup() ? ctx.cacheContext(entry.cacheId()) 
> : grp.singleCacheContext();
> cached = cctx.dhtCache().entryEx(entry.key());
> //                cctx = cached.context();
> if (log.isDebugEnabled())
>     log.debug("Rebalancing key [key=" + entry.key() + ", part=" + p + ", 
> node=" + from.id() + ']');
> if (preloadPred == null || preloadPred.apply(entry)) {
>     if (cached.initialValue(
>         entry.value(),
>         entry.version(),
>         entry.ttl(),
>         entry.expireTime(),
>         true,
>         topVer,
>         cctx.isDrEnabled() ? DR_PRELOAD : DR_NONE,
>         false
>     )) {
>         cctx.evicts().touch(cached, topVer); // Start tracking.
> {code}
> Here `cached` is always DHT entry, but `cctx` can be near.
> There is a similar bug in 
> GridCacheUtils.createBackupPostProcessingClosure.BackupPostProcessingClosure.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to