ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [13/26] ignite git commit: IGNITE-6256: DiscoCache always contains local node.
Date Mon, 18 Sep 2017 08:43:13 GMT
IGNITE-6256: DiscoCache always contains local node.

Signed-off-by: Andrey Gura <agura@apache.org>


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

Branch: refs/heads/ignite-6149
Commit: 4a88ec3ec2a6a5d5004187a3424f5832217fda9c
Parents: fe06b59
Author: Andrey V. Mashenkov <andrey.mashenkov@gmail.com>
Authored: Fri Sep 15 16:45:02 2017 +0300
Committer: Andrey Gura <agura@apache.org>
Committed: Fri Sep 15 16:49:07 2017 +0300

----------------------------------------------------------------------
 .../managers/discovery/GridDiscoveryManager.java      | 12 +++++++-----
 .../apache/ignite/spi/discovery/tcp/ServerImpl.java   | 14 +++++++-------
 2 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4a88ec3e/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index fa5d053..eefec08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -775,7 +775,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                     topHist.clear();
 
                     topSnap.set(new Snapshot(AffinityTopologyVersion.ZERO,
-                        createDiscoCache(AffinityTopologyVersion.ZERO, ctx.state().clusterState(),
locNode, Collections.<ClusterNode>emptySet())));
+                        createDiscoCache(AffinityTopologyVersion.ZERO, ctx.state().clusterState(),
locNode, Collections.<ClusterNode>singleton(locNode))));
                 }
                 else if (type == EVT_CLIENT_NODE_RECONNECTED) {
                     assert locNode.isClient() : locNode;
@@ -2189,6 +2189,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
         DiscoveryDataClusterState state,
         ClusterNode loc,
         Collection<ClusterNode> topSnapshot) {
+        assert topSnapshot.contains(loc);
+
         HashSet<UUID> alives = U.newHashSet(topSnapshot.size());
         HashMap<UUID, ClusterNode> nodeMap = U.newHashMap(topSnapshot.size());
 
@@ -2390,15 +2392,15 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                     lastChk = now;
 
                     if (!segValid) {
-                        List<ClusterNode> empty = Collections.emptyList();
-
                         ClusterNode node = getSpi().getLocalNode();
 
+                        Collection<ClusterNode> locNodeOnlyTop = Collections.singleton(node);
+
                         discoWrk.addEvent(EVT_NODE_SEGMENTED,
                             AffinityTopologyVersion.NONE,
                             node,
-                            createDiscoCache(AffinityTopologyVersion.NONE, null, node, empty),
-                            empty,
+                            createDiscoCache(AffinityTopologyVersion.NONE, null, node, locNodeOnlyTop),
+                            locNodeOnlyTop,
                             null);
 
                         lastSegChkRes.set(false);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4a88ec3e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index c227bf7..9433ffb 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -465,7 +465,6 @@ class ServerImpl extends TcpDiscoveryImpl {
         U.interrupt(statsPrinter);
         U.join(statsPrinter, log);
 
-        Collection<TcpDiscoveryNode> rmts = null;
         Collection<TcpDiscoveryNode> nodes = null;
 
         if (!disconnect)
@@ -474,22 +473,23 @@ class ServerImpl extends TcpDiscoveryImpl {
             spi.getSpiContext().deregisterPorts();
 
             nodes = ring.visibleNodes();
-            rmts = F.view(nodes, F.remoteNodes(locNode.id()));
         }
 
         long topVer = ring.topologyVersion();
 
         ring.clear();
 
-        if (rmts != null && !rmts.isEmpty()) {
-            // This is restart/disconnection and remote nodes are not empty.
-            // We need to fire FAIL event for each.
+        if (nodes != null) {
+            // This is restart/disconnection and we need to fire FAIL event for each remote
node.
             DiscoverySpiListener lsnr = spi.lsnr;
 
             if (lsnr != null) {
-                Collection<ClusterNode> processed = new HashSet<>();
+                Collection<ClusterNode> processed = new HashSet<>(nodes.size());
+
+                for (TcpDiscoveryNode n : nodes) {
+                    if(n.isLocal())
+                        continue;
 
-                for (TcpDiscoveryNode n : rmts) {
                     assert n.visible();
 
                     processed.add(n);


Mime
View raw message