You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2018/11/29 12:16:46 UTC

[50/50] [abbrv] ignite git commit: 10044

10044


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

Branch: refs/heads/ignite-10044
Commit: e0657d718fcf54862295b3fc224580a901ef6d59
Parents: c969d6a
Author: sboikov <sb...@apache.org>
Authored: Thu Nov 29 14:47:09 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Thu Nov 29 15:15:12 2018 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  7 +++---
 .../topology/GridClientPartitionTopology.java   | 20 ++++++++---------
 .../topology/GridDhtPartitionTopologyImpl.java  | 23 ++++++++------------
 .../IgniteCachePartitionLossPolicySelfTest.java |  2 +-
 .../junits/common/GridCommonAbstractTest.java   |  5 +++++
 5 files changed, 28 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 2322d8b..000791d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -3255,6 +3255,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
             if (firstDiscoEvt.type() == EVT_DISCOVERY_CUSTOM_EVT) {
                 assert firstDiscoEvt instanceof DiscoveryCustomEvent;
+                assert !events().hasServerJoin() && !events().hasServerLeft();
 
                 if (activateCluster() || changedBaseline())
                     assignPartitionsStates();
@@ -3276,11 +3277,11 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     assignPartitionsStates();
             }
             else {
-                if (exchCtx.events().hasServerJoin())
-                    assignPartitionsStates();
-
                 if (exchCtx.events().hasServerLeft())
                     detectLostPartitions(resTopVer, true);
+
+                if (exchCtx.events().hasServerJoin())
+                    assignPartitionsStates();
             }
 
             // Recalculate new affinity based on partitions availability.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
index b1f6e19..feca1e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
@@ -944,6 +944,15 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
             if (cur == null || !cur.equals(parts))
                 changed = true;
 
+            if (lostParts != null) {
+                for (Integer lostPart : lostParts) {
+                    GridDhtPartitionState state0 = parts.get(lostPart);
+
+                    if (state0 != null && state0.active())
+                        parts.put(lostPart, LOST);
+                }
+            }
+
             node2part.put(parts.nodeId(), parts);
 
             // Add new mappings.
@@ -1245,17 +1254,6 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
                 }
             }
 
-            if (lostParts != null) {
-                for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
-                    for (Integer part : lostParts) {
-                        GridDhtPartitionState state = e.getValue().get(part);
-
-                        if (state != null && state.active())
-                            e.getValue().put(part, LOST);
-                    }
-                }
-            }
-
             for (Map.Entry<Integer, Set<UUID>> entry : ownersByUpdCounters.entrySet())
                 part2node.put(entry.getKey(), entry.getValue());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
index 187bf9c..d518467 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
@@ -1807,6 +1807,15 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                 if (cur == null || !cur.equals(parts))
                     changed = true;
 
+                if (lostParts != null) {
+                    for (Integer lostPart : lostParts) {
+                        GridDhtPartitionState state0 = parts.get(lostPart);
+
+                        if (state0 != null && state0.active())
+                            parts.put(lostPart, LOST);
+                    }
+                }
+
                 node2part.put(parts.nodeId(), parts);
 
                 // During exchange diff is calculated after all messages are received and affinity initialized.
@@ -2260,20 +2269,6 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                     }
                 }
 
-                if (lostParts != null) {
-                    for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
-                        if (e.getKey().equals(ctx.localNodeId()))
-                            continue;
-
-                        for (Integer part : lostParts) {
-                            GridDhtPartitionState state = e.getValue().get(part);
-
-                            if (state != null && state.active())
-                                e.getValue().put(part, LOST);
-                        }
-                    }
-                }
-
                 node2part = new GridDhtPartitionFullMap(node2part, updateSeq.incrementAndGet());
             } finally {
                 lock.writeLock().unlock();

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
index 6f4b260..100cc74 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
@@ -626,7 +626,7 @@ public class IgniteCachePartitionLossPolicySelfTest extends GridCommonAbstractTe
         }
 
         // Make sure cache did not really start on coordinator,
-        if (!clientCacheOnCrd)
+        if (!clientCacheOnCrd && topChanger.aliveNodes.contains(0))
             assertNull(((IgniteEx)ignite(0)).context().cache().cacheGroup(CU.cacheId(CACHE_EXCLUDE_ON_CRD)));
 
         // Start new nodes after lost partitions reset.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index c931a0d..3017a71 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -647,6 +647,9 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                         long start = 0;
 
                         for (int i = 0; ; i++) {
+                            if (c.lostPartitions().contains(p))
+                                break;
+
                             boolean match = false;
 
                             GridCachePartitionExchangeManager<?, ?> exchMgr = dht.context().shared().exchange();
@@ -701,6 +704,8 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                                             ", affNodes=" + F.nodeIds(affNodes) +
                                             ", owners=" + F.nodeIds(owners) +
                                             ", topFut=" + topFut +
+                                            ", lostParts=" + c.lostPartitions() +
+                                            ", locState=" + (loc != null ? loc.state() : null) +
                                             ", locNode=" + g.cluster().localNode() + ']');
                                 }
                                 else