ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-1758
Date Mon, 16 Nov 2015 18:26:52 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1758-debug 1a1cb8ca6 -> b4ea667c1


ignite-1758


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

Branch: refs/heads/ignite-1758-debug
Commit: b4ea667c13721e93698c3389ece053456d839b35
Parents: 1a1cb8c
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Nov 16 21:26:26 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Nov 16 21:26:26 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  6 +-
 .../tcp/internal/TcpDiscoveryNodesRing.java     | 86 ++++++--------------
 2 files changed, 30 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b4ea667c/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 2356404..2f93e25 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
@@ -160,7 +160,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
     /** */
     private static final IgniteProductVersion CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE
=
-            IgniteProductVersion.fromString("1.5.0");
+        IgniteProductVersion.fromString("1.5.0");
 
     /** */
     private final ThreadPoolExecutor utilityPool = new ThreadPoolExecutor(0, 1, 2000, TimeUnit.MILLISECONDS,
@@ -4475,7 +4475,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 assert ring.minimumNodeVersion() != null : ring;
 
                 if (ring.minimumNodeVersion().compareTo(CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE)
>= 0)
-                    delayMsg = msg.topologyVersion() == 0L && !joiningNodes.isEmpty();
+                    delayMsg = !joiningNodes.isEmpty();
                 else
                     delayMsg = !joiningNodes.isEmpty();
 
@@ -4555,7 +4555,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 if (msg.verified() && state0 == CONNECTED && pendingMsgs.procCustomMsgs.add(msg.id()))
{
                     assert msg.topologyVersion() == ring.topologyVersion() :
-                        "msg: " + msg + ", topver=" + ring.topologyVersion();
+                        "msg: " + msg + ", topVer=" + ring.topologyVersion();
 
                     notifyDiscoveryListener(msg);
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4ea667c/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
index 8e6274f..eb0f74a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
@@ -96,7 +96,14 @@ public class TcpDiscoveryNodesRing {
      * @return Minimum node version.
      */
     public IgniteProductVersion minimumNodeVersion() {
-        return minNodeVer;
+        rwLock.readLock().lock();
+
+        try {
+            return minNodeVer;
+        }
+        finally {
+            rwLock.readLock().unlock();
+        }
     }
 
     /**
@@ -115,8 +122,6 @@ public class TcpDiscoveryNodesRing {
             clear();
 
             maxInternalOrder = locNode.internalOrder();
-
-            minNodeVer = locNode.version();
         }
         finally {
             rwLock.writeLock().unlock();
@@ -239,8 +244,7 @@ public class TcpDiscoveryNodesRing {
 
             maxInternalOrder = node.internalOrder();
 
-            if (node.version().compareTo(minNodeVer) < 0)
-                minNodeVer = node.version();
+            initializeMinimumVersion();
         }
         finally {
             rwLock.writeLock().unlock();
@@ -311,6 +315,8 @@ public class TcpDiscoveryNodesRing {
             }
 
             nodeOrder = topVer;
+
+            initializeMinimumVersion();
         }
         finally {
             rwLock.writeLock().unlock();
@@ -357,6 +363,8 @@ public class TcpDiscoveryNodesRing {
                 nodes.remove(rmv);
             }
 
+            initializeMinimumVersion();
+
             return rmv;
         }
         finally {
@@ -388,6 +396,8 @@ public class TcpDiscoveryNodesRing {
             maxInternalOrder = 0;
 
             topVer = 0;
+
+            minNodeVer = locNode.version();
         }
         finally {
             rwLock.writeLock().unlock();
@@ -495,60 +505,6 @@ public class TcpDiscoveryNodesRing {
     }
 
     /**
-     * Finds previous node in the topology.
-     *
-     * @return Previous node.
-     */
-    @Nullable public TcpDiscoveryNode previousNode() {
-        rwLock.readLock().lock();
-
-        try {
-            if (nodes.size() < 2)
-                return null;
-
-            return previousNode(null);
-        }
-        finally {
-            rwLock.readLock().unlock();
-        }
-    }
-
-    /**
-     * Finds previous node in the topology filtering excluded nodes from search.
-     *
-     * @param excluded Nodes to exclude from the search (optional). If provided,
-     * cannot contain local node.
-     * @return Previous node or {@code null} if all nodes were filtered out or
-     * topology contains less than two nodes.
-     */
-    @Nullable public TcpDiscoveryNode previousNode(@Nullable Collection<TcpDiscoveryNode>
excluded) {
-        assert excluded == null || excluded.isEmpty() || !excluded.contains(locNode);
-
-        rwLock.readLock().lock();
-
-        try {
-            Collection<TcpDiscoveryNode> filtered = serverNodes(excluded);
-
-            if (filtered.size() < 2)
-                return null;
-
-            Iterator<TcpDiscoveryNode> iter = filtered.iterator();
-
-            while (iter.hasNext()) {
-                TcpDiscoveryNode node = iter.next();
-
-                if (locNode.equals(node))
-                    break;
-            }
-
-            return iter.hasNext() ? iter.next() : F.first(filtered);
-        }
-        finally {
-            rwLock.readLock().unlock();
-        }
-    }
-
-    /**
      * Gets current topology version.
      *
      * @return Current topology version.
@@ -655,6 +611,18 @@ public class TcpDiscoveryNodesRing {
         });
     }
 
+    /**
+     *
+     */
+    private void initializeMinimumVersion() {
+        minNodeVer = null;
+
+        for (TcpDiscoveryNode node : nodes) {
+            if (minNodeVer == null || node.version().compareTo(minNodeVer) < 0)
+                minNodeVer = node.version();
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         rwLock.readLock().lock();


Mime
View raw message