ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [24/25] ignite git commit: IGNITE-6068 Fixed InvalidPartitionException during index visit
Date Wed, 16 Aug 2017 15:41:47 GMT
IGNITE-6068 Fixed InvalidPartitionException during index visit


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c5adf46c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c5adf46c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c5adf46c

Branch: refs/heads/ignite-5901
Commit: c5adf46cc1970c7d6e57e94b18f2c91443cc5401
Parents: bfb4c21
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Wed Aug 16 17:59:11 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Wed Aug 16 17:59:11 2017 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  | 38 +++++++-------
 .../schema/SchemaIndexCacheVisitorImpl.java     |  7 +++
 .../IgnitePdsCacheRebalancingAbstractTest.java  | 53 +++++++++++---------
 3 files changed, 55 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c5adf46c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 725822d..dbfb426 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -953,24 +953,26 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl
implements
 
                         ctx.database().checkpointReadLock();
 
-                        try {if (cached instanceof GridDhtCacheEntry && ((GridDhtCacheEntry)cached).clearInternal(clearVer,
extras)) {
-                            removeEntry(cached);
-
-                            if (rec) {
-                                hld.cctx.events().addEvent(cached.partition(),
-                                    cached.key(),
-                                    ctx.localNodeId(),
-                                    (IgniteUuid)null,
-                                    null,
-                                    EVT_CACHE_REBALANCE_OBJECT_UNLOADED,
-                                    null,
-                                    false,
-                                    cached.rawGet(),
-                                    cached.hasValue(),
-                                    null,
-                                    null,
-                                    null,
-                                    false);}
+                        try {
+                            if (cached instanceof GridDhtCacheEntry && ((GridDhtCacheEntry)cached).clearInternal(clearVer,
extras)) {
+                                removeEntry(cached);
+
+                                if (rec) {
+                                    hld.cctx.events().addEvent(cached.partition(),
+                                        cached.key(),
+                                        ctx.localNodeId(),
+                                        (IgniteUuid)null,
+                                        null,
+                                        EVT_CACHE_REBALANCE_OBJECT_UNLOADED,
+                                        null,
+                                        false,
+                                        cached.rawGet(),
+                                        cached.hasValue(),
+                                        null,
+                                        null,
+                                        null,
+                                        false);
+                                }
                             }
                         }
                         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/c5adf46c/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
index 3a445bf..4e50f64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
@@ -118,6 +119,9 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor
{
                 KeyCacheObject key = row.key();
 
                 processKey(key, row.link(), clo);
+
+                if (part.state() == RENTING)
+                    break;
             }
         }
         finally {
@@ -149,6 +153,9 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor
{
 
                 break;
             }
+            catch (GridDhtInvalidPartitionException ignore) {
+                break;
+            }
             catch (GridCacheEntryRemovedException ignored) {
                 // No-op.
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c5adf46c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
index c463871..9ceb87c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
@@ -37,8 +37,8 @@ import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
 import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
 import org.apache.ignite.configuration.PersistentStoreConfiguration;
 import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.internal.IgniteEx;
@@ -63,7 +63,7 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends GridCommonAb
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** Cache name. */
-    private final String cacheName = "cache";
+    private static final String cacheName = "cache";
 
     /** */
     protected boolean explicitTx;
@@ -288,10 +288,10 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends
GridCommonAb
         IgniteEx ignite3 = (IgniteEx)G.start(getConfiguration("test3"));
         IgniteEx ignite4 = (IgniteEx)G.start(getConfiguration("test4"));
 
-        awaitPartitionMapExchange();
-
         ignite1.active(true);
 
+        awaitPartitionMapExchange();
+
         IgniteCache<Integer, Integer> cache1 = ignite1.cache(cacheName);
 
         for (int i = 0; i < 100; i++)
@@ -307,10 +307,10 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends
GridCommonAb
         ignite3 = (IgniteEx)G.start(getConfiguration("test3"));
         ignite4 = (IgniteEx)G.start(getConfiguration("test4"));
 
-        awaitPartitionMapExchange();
-
         ignite1.active(true);
 
+        awaitPartitionMapExchange();
+
         cache1 = ignite1.cache(cacheName);
         IgniteCache<Integer, Integer> cache2 = ignite2.cache(cacheName);
         IgniteCache<Integer, Integer> cache3 = ignite3.cache(cacheName);
@@ -459,32 +459,35 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends
GridCommonAb
             }
         }, 1, "load-runner");
 
-        for (int i = 0; i < topChanges; i++) {
-            if (U.currentTimeMillis() > timeOut)
-                break;
+        try {
+            for (int i = 0; i < topChanges; i++) {
+                if (U.currentTimeMillis() > timeOut)
+                    break;
 
-            U.sleep(3_000);
+                U.sleep(3_000);
 
-            boolean add;
+                boolean add;
 
-            if (nodesCnt.get() <= maxNodesCount / 2)
-                add = true;
-            else if (nodesCnt.get() > maxNodesCount)
-                add = false;
-            else // More chance that node will be added
-                add = ThreadLocalRandom.current().nextInt(3) <= 1;
+                if (nodesCnt.get() <= maxNodesCount / 2)
+                    add = true;
+                else if (nodesCnt.get() > maxNodesCount)
+                    add = false;
+                else // More chance that node will be added
+                    add = ThreadLocalRandom.current().nextInt(3) <= 1;
 
-            if (add)
-                startGrid(nodesCnt.incrementAndGet());
-            else
-                stopGrid(nodesCnt.getAndDecrement());
+                if (add)
+                    startGrid(nodesCnt.incrementAndGet());
+                else
+                    stopGrid(nodesCnt.getAndDecrement());
 
-            awaitPartitionMapExchange();
+                awaitPartitionMapExchange();
 
-            cache.rebalance().get();
+                cache.rebalance().get();
+            }
+        }
+        finally {
+            stop.set(true);
         }
-
-        stop.set(true);
 
         fut.get();
 


Mime
View raw message