You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vyacheslav Koptilin (JIRA)" <ji...@apache.org> on 2017/11/08 11:43:00 UTC

[jira] [Comment Edited] (IGNITE-6767) NearCache#localPeek(key, NEAR) always returns 'null' if the node, which owns the primary partition for the given key, left the cluster.

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

Vyacheslav Koptilin edited comment on IGNITE-6767 at 11/8/17 11:42 AM:
-----------------------------------------------------------------------

Hi [~Timay]

1. Please add the test to the {{IgniteCacheTestSuite2}}

2. I would prefer the following patch which is very similar to the provided by you

{code:java}
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -379,7 +379,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
                 CacheObject old = this.val;
                 boolean hasVal = hasValueUnlocked();

-                if (this.dhtVer == null || this.dhtVer.compareTo(dhtVer) < 0) {
+                if ((this.dhtVer == null || this.dhtVer.compareTo(dhtVer) < 0) || !valid(topVer)) {
                     primaryNode(primaryNodeId, topVer);

                     update(val, expireTime, ttl, ver, true);
{code}


was (Author: slava.koptilin):
Hi [~Timay]

I would prefer the following patch which is very similar to the provided by you

{code:java}
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -379,7 +379,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
                 CacheObject old = this.val;
                 boolean hasVal = hasValueUnlocked();

-                if (this.dhtVer == null || this.dhtVer.compareTo(dhtVer) < 0) {
+                if ((this.dhtVer == null || this.dhtVer.compareTo(dhtVer) < 0) || !valid(topVer)) {
                     primaryNode(primaryNodeId, topVer);

                     update(val, expireTime, ttl, ver, true);
{code}

> NearCache#localPeek(key, NEAR) always returns 'null' if the node, which owns the primary partition for the given key, left the cluster.
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-6767
>                 URL: https://issues.apache.org/jira/browse/IGNITE-6767
>             Project: Ignite
>          Issue Type: Bug
>      Security Level: Public(Viewable by anyone) 
>          Components: cache
>    Affects Versions: 2.1
>            Reporter: Vyacheslav Koptilin
>         Attachments: GridCacheNearClientHitTest.java
>
>
> {{IgniteCache.localPeek(key, PeekMode.NEAR)}} always returns 'null' if the node, which owns the primary partition for the given key, left the cluster, even if {{IgniteCache.get(key)}} was called.
> How to reproduce:
> # start two server nodes.
> # create partitioned or atomic cache and populate data.
> # start client node with near cache configured.
> # perform {{IgniteCache.get(key)}} and check that {{IgniteCache.localPeek(key, PeekMode.NEAR)}} returns not null value.
> # stop server node which owns primary partition for the given {{key}}.
> # perform {{IgniteCache.get(key)}}.
> # after that {{IgniteCache.localPeek(key, PeekMode.NEAR)}} always returns null value.
> This issue was reported on the user-list: http://apache-ignite-users.70518.x6.nabble.com/Near-Cache-Topoolgy-change-causes-NearCache-to-always-miss-tt17539.html



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)