ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [50/50] incubator-ignite git commit: ignite-882: fixed duplicate node ID issue
Date Fri, 03 Jul 2015 09:37:01 GMT
ignite-882: fixed duplicate node ID issue


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

Branch: refs/heads/ignite-882
Commit: dc8da054cbe26e14d1964c58d5205de75d29eea6
Parents: f2871a7
Author: Denis Magda <dmagda@gridgain.com>
Authored: Fri Jul 3 12:35:48 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Fri Jul 3 12:35:48 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  5 ---
 .../org/apache/ignite/internal/IgnitionEx.java  |  2 -
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  2 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 44 +++++++++++++-------
 .../TcpDiscoveryNodeAddFinishedMessage.java     |  2 -
 .../messages/TcpDiscoveryNodeFailedMessage.java |  2 -
 .../junits/logger/GridTestLog4jLogger.java      |  6 ++-
 7 files changed, 34 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 9318268..2d36c7a 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -491,9 +491,6 @@ public class IgniteConfiguration {
         utilityCachePoolSize = cfg.getUtilityCacheThreadPoolSize();
         waitForSegOnStart = cfg.isWaitForSegmentOnStart();
         warmupClos = cfg.getWarmupClosure();
-
-        if (nodeId != null)
-            U.dumpStack(log, "New node UUID:" + nodeId);
     }
 
     /**
@@ -945,8 +942,6 @@ public class IgniteConfiguration {
      * @return {@code this} for chaining.
      */
     public IgniteConfiguration setNodeId(UUID nodeId) {
-        U.dumpStack(log, "Node ID: " + nodeId);
-
         this.nodeId = nodeId;
 
         return this;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index cdcab91..5cbe377 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1625,8 +1625,6 @@ public class IgnitionEx {
 
             UUID nodeId = cfg.getNodeId() != null ? cfg.getNodeId() : UUID.randomUUID();
 
-            U.debug("New UUID: " + nodeId + ", from cfg = " + (cfg.getNodeId() != null));
-
             myCfg.setNodeId(nodeId);
 
             IgniteLogger cfgLog = initLogger(cfg.getGridLogger(), nodeId);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 5bd63ac..3f05f59 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -1288,7 +1288,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                     if (topChanged) {
                         if (log.isDebugEnabled())
-                            log.debug("TCP Added new node to topology: " + node);
+                            log.debug("Added new node to topology: " + node);
 
                         Map<Integer, byte[]> data = msg.newNodeDiscoveryData();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/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 3b3c328..f8fae34 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
@@ -710,18 +710,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                         "[locNodeAddrs=" + U.addressesAsString(locNode) + ", rmtNodeAddrs="
+
                         U.addressesAsString(msg.addresses(), msg.hostNames()) + ']');
                 }
-                else {
-                    U.debug("STATE: " + spiState);
-
+                else
                     LT.warn(log, null, "Node has not been connected to topology and will
repeat join process. " +
                         "Check remote nodes logs for possible error messages. " +
                         "Note that large topology may require significant time to start.
" +
                         "Increase 'TcpDiscoverySpi.networkTimeout' configuration property
" +
                         "if getting this message on the starting nodes [networkTimeout="
+ spi.netTimeout + ']');
-
-
-                    U.dumpStack("HALF-OPENED SOCKET PROBLEM");
-                }
             }
         }
 
@@ -2082,6 +2076,9 @@ class ServerImpl extends TcpDiscoveryImpl {
                                         boolean nextNew = (msg instanceof TcpDiscoveryNodeAddedMessage
&&
                                             ((TcpDiscoveryNodeAddedMessage)msg).node().id().equals(nextId));
 
+                                        if (!nextNew)
+                                            nextNew = hasPendingAddMessage(nextId);
+
                                         if (!nextNew) {
                                             if (log.isDebugEnabled())
                                                 log.debug("Failed to restore ring because
next node order received " +
@@ -2370,6 +2367,29 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
+         * Checks whether pending messages queue contains unprocessed {@link TcpDiscoveryNodeAddedMessage}
for
+         * the node with {@code nodeId}.
+         *
+         * @param nodeId Node ID.
+         * @return {@code true} if contains, {@code false} otherwise.
+         */
+        private boolean hasPendingAddMessage(UUID nodeId) {
+            if (pendingMsgs.msgs.isEmpty())
+                return false;
+
+            for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs.msgs) {
+                if (pendingMsg instanceof TcpDiscoveryNodeAddedMessage) {
+                    TcpDiscoveryNodeAddedMessage addMsg = (TcpDiscoveryNodeAddedMessage)pendingMsg;
+
+                    if (addMsg.node().id().equals(nodeId) && addMsg.id().compareTo(pendingMsgs.discardId)
> 0)
+                        return true;
+                }
+            }
+
+            return false;
+        }
+
+        /**
          * Processes join request message.
          *
          * @param msg Join request message.
@@ -4245,8 +4265,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         msg.senderNodeId(nodeId);
 
-//                        if (log.isDebugEnabled())
-                            U.debug("Message has been received: " + msg + " NODE " + nodeId);
+                        if (log.isDebugEnabled())
+                            log.debug("Message has been received: " + msg);
 
                         spi.stats.onMessageReceived(msg);
 
@@ -4522,7 +4542,6 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (state == CONNECTED) {
                 spi.writeToSocket(msg, sock, RES_OK);
 
-                U.debug("Responded (1) to join request message [msg=" + msg + ", res=" +
RES_OK + ']');
                 if (log.isDebugEnabled())
                     log.debug("Responded to join request message [msg=" + msg + ", res="
+ RES_OK + ']');
 
@@ -4557,8 +4576,6 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 spi.writeToSocket(msg, sock, res);
 
-                U.debug("Responded (2) to join request message [msg=" + msg + ", res=" +
res + ']');
-
                 if (log.isDebugEnabled())
                     log.debug("Responded to join request message [msg=" + msg + ", res="
+ res + ']');
 
@@ -4829,9 +4846,6 @@ class ServerImpl extends TcpDiscoveryImpl {
          * @param msg Message to add.
          */
         void addMessage(TcpDiscoveryAbstractMessage msg) {
-            if (msg instanceof TcpDiscoveryNodeAddFinishedMessage)
-                U.dumpStack("Putting add finished to queue: " + msg);
-
             if (msg.highPriority())
                 queue.addFirst(msg);
             else

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
index d93268c..1d974e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
@@ -55,8 +55,6 @@ public class TcpDiscoveryNodeAddFinishedMessage extends TcpDiscoveryAbstractMess
     public TcpDiscoveryNodeAddFinishedMessage(UUID creatorNodeId, UUID nodeId) {
         super(creatorNodeId);
 
-        U.dumpStack("NODE ADD FINISHED MESS: " + creatorNodeId + ", node = " + nodeId);
-
         this.nodeId = nodeId;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
index 7c3a5b7..93ecdaa 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
@@ -51,8 +51,6 @@ public class TcpDiscoveryNodeFailedMessage extends TcpDiscoveryAbstractMessage
{
     public TcpDiscoveryNodeFailedMessage(UUID creatorNodeId, UUID failedNodeId, long order)
{
         super(creatorNodeId);
 
-        U.dumpStack("Node Failed Event: [creator=" + creatorNodeId + ", failedNode=" + failedNodeId
+ ", order=" + order + "]");
-
         assert failedNodeId != null;
         assert order > 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dc8da054/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
index 76c5a4e..8f45062 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
@@ -120,7 +120,7 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware
{
 
         if (init) {
             // Implementation has already been inited, passing NULL.
-            addConsoleAppenderIfNeeded(Level.DEBUG, null);
+            addConsoleAppenderIfNeeded(Level.INFO, null);
 
             quiet = quiet0;
         }
@@ -450,6 +450,8 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware
{
 
     /** {@inheritDoc} */
     @Override public void debug(String msg) {
+        if (!impl.isDebugEnabled())
+            warning("Logging at DEBUG level without checking if DEBUG level is enabled: "
+ msg);
 
         impl.debug(msg);
     }
@@ -489,7 +491,7 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware
{
 
     /** {@inheritDoc} */
     @Override public boolean isDebugEnabled() {
-        return true;
+        return impl.isDebugEnabled();
     }
 
     /** {@inheritDoc} */


Mime
View raw message