ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [2/6] incubator-ignite git commit: ignite-747: generic fix after the review
Date Tue, 07 Jul 2015 11:26:38 GMT
ignite-747: generic fix after the review


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

Branch: refs/heads/ignite-747
Commit: ee7f7215b036306027c5af45d8af7e410a7bdd17
Parents: 51216ca
Author: Denis Magda <dmagda@gridgain.com>
Authored: Tue Jul 7 14:08:58 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Tue Jul 7 14:08:58 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java     | 19 ++++++++++++++++++-
 .../tcp/internal/TcpDiscoveryStatistics.java     | 10 ++++++++--
 2 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ee7f7215/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 701db69..d95ac3b 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
@@ -2855,9 +2855,26 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 msg.verify(locNodeId);
             }
+            else if (!locNodeId.equals(node.id()) && ring.node(node.id()) != null)
{
+                // Local node already has node from message in local topology.
+                // Just pass it to coordinator via the ring.
+                sendMessageAcrossRing(msg);
+
+                if (log.isDebugEnabled())
+                    log.debug("Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage
to " +
+                                  "coordinator for final processing [ring=" + ring + ", node="
+ node + ", locNode="
+                                  + locNode + ", msg=" + msg + ']');
+
+                if (debugMode)
+                    debugLog("Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage
to " +
+                                 "coordinator for final processing [ring=" + ring + ", node="
+ node + ", locNode="
+                                 + locNode + ", msg=" + msg + ']');
+
+                return;
+            }
 
             if (msg.verified() && !locNodeId.equals(node.id())) {
-                if (node.internalOrder() <= ring.maxInternalOrder() && spiState
!= STOPPING) {
+                if (node.internalOrder() <= ring.maxInternalOrder()) {
                     if (log.isDebugEnabled())
                         log.debug("Discarding node added message since new node's order is
less than " +
                             "max order in ring [ring=" + ring + ", node=" + node + ", locNode="
+ locNode +

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ee7f7215/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
index da8c4ea..377d8a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
@@ -256,7 +256,10 @@ public class TcpDiscoveryStatistics {
             if (maxMsgQueueTime < duration)
                 maxMsgQueueTime = duration;
 
-            avgMsgQueueTime = (avgMsgQueueTime * (totalReceivedMessages() -1)) / totalProcessedMessages();
+            int totalProcMsgs = totalProcessedMessages();
+
+            if (totalProcMsgs != 0)
+                avgMsgQueueTime = (avgMsgQueueTime * (totalProcMsgs - 1)) / totalProcMsgs;
         }
 
         msgsProcStartTs.put(msg.id(), U.currentTimeMillis());
@@ -275,7 +278,10 @@ public class TcpDiscoveryStatistics {
         if (startTs != null) {
             long duration = U.currentTimeMillis() - startTs;
 
-            avgMsgProcTime = (avgMsgProcTime * (totalProcessedMessages() - 1) + duration)
/ totalProcessedMessages();
+            int totalProcMsgs = totalProcessedMessages();
+
+            if (totalProcMsgs != 0)
+                avgMsgProcTime = (avgMsgProcTime * (totalProcMsgs - 1) + duration) / totalProcMsgs;
 
             if (duration > maxMsgProcTime) {
                 maxMsgProcTime = duration;


Mime
View raw message