ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject ignite git commit: debugging
Date Tue, 22 Sep 2015 16:36:54 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1171-debug af6deb8bb -> 271b7501c


debugging


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

Branch: refs/heads/ignite-1171-debug
Commit: 271b7501cfe53b046a69c3930a9bed3ed4dffb12
Parents: af6deb8
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Tue Sep 22 19:36:33 2015 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Tue Sep 22 19:36:33 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 37 +++++++-
 .../tcp/internal/TcpDiscoveryNodesRing.java     | 94 +++++++-------------
 ...GridCacheValueConsistencyAtomicSelfTest.java |  2 +-
 3 files changed, 67 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/271b7501/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 69dd512..3d624d8 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
@@ -2044,6 +2044,10 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (log.isDebugEnabled())
                 log.debug("Processing message [cls=" + msg.getClass().getSimpleName() + ",
id=" + msg.id() + ']');
 
+            U.debug(
+                log,
+                "Processing message [cls=" + msg.getClass().getSimpleName() + ", id=" + msg.id()
+ ']');
+
             if (debugMode)
                 debugLog("Processing message [cls=" + msg.getClass().getSimpleName() + ",
id=" + msg.id() + ']');
 
@@ -2417,6 +2421,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                                             ", pendingMsgId=" + pendingMsg.id() + ", next="
+ next.id() +
                                             ", res=" + res + ']');
 
+                                    U.debug(
+                                        log,
+                                        "Pending message has been sent to next node [msgId="
+ msg.id() +
+                                            ", pendingMsgId=" + pendingMsg.id() + ", next="
+ next.id() +
+                                            ", res=" + res + ']');
+
                                     if (debugMode)
                                         debugLog("Pending message has been sent to next node
[msgId=" + msg.id() +
                                             ", pendingMsgId=" + pendingMsg.id() + ", next="
+ next.id() +
@@ -2955,6 +2965,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                 TcpDiscoveryNodeAddedMessage nodeAddedMsg = new TcpDiscoveryNodeAddedMessage(locNodeId,
                     node, msg.discoveryData(), spi.gridStartTime);
 
+                U.debug(log, "Create node added msg: " + nodeAddedMsg);
+
                 nodeAddedMsg.client(msg.client());
 
                 processNodeAddedMessage(nodeAddedMsg);
@@ -3177,7 +3189,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 joiningNodes.add(node.id());
 
-                U.debug(log, "Added joining node [joiningNodes=" + joiningNodes + ", node="
+ node.id() + ']');
+                U.debug(log, "Added joining node [joiningNodes=" + joiningNodes + ", node="
+ node.id() +
+                        ", msg=" + msg.id() + ']');
 
                 if (!isLocalNodeCoordinator() && spi.nodeAuth != null &&
spi.nodeAuth.isGlobalNodeAuthentication()) {
                     boolean authFailed = true;
@@ -3430,6 +3443,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (log.isDebugEnabled())
                         log.debug("Topology version has been updated: [ring=" + ring + ",
msg=" + msg + ']');
 
+                    U.debug(
+                        log,
+                        "Topology version has been updated: [ring=" + ring + ", msg=" + msg
+ ']');
+
                     lastMsg = msg;
                 }
 
@@ -3589,6 +3606,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (log.isDebugEnabled())
                         log.debug("Topology version has been updated: [ring=" + ring + ",
msg=" + msg + ']');
 
+                    U.debug(
+                        log,
+                        "Topology version has been updated: [ring=" + ring + ", msg=" + msg
+ ']');
+
                     lastMsg = msg;
                 }
 
@@ -3761,6 +3782,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (log.isDebugEnabled())
                         log.debug("Topology version has been updated: [ring=" + ring + ",
msg=" + msg + ']');
 
+                    U.debug(
+                        log,
+                        "Topology version has been updated: [ring=" + ring + ", msg=" + msg
+ ']');
+
                     lastMsg = msg;
                 }
 
@@ -4240,8 +4265,16 @@ class ServerImpl extends TcpDiscoveryImpl {
                     state0 = spiState;
                 }
 
+                if (msg.verified() && msg.topologyVersion() != ring.topologyVersion())
{
+                    U.debug(log, "Discarding custom message: " + msg + ", topver=" + ring.topologyVersion());
+
+                    return;
+                }
+
                 if (msg.verified() && state0 == CONNECTED && pendingMsgs.procCustomMsgs.add(msg.id()))
{
-                    assert joiningNodes.isEmpty() : "Joining nodes: " + joiningNodes + ",
msg=" + msg + ", loc=" + locNode.id();
+                    assert joiningNodes.isEmpty() : "Joining nodes: " + joiningNodes + ",
msg=" + msg + ", loc=" + locNode.id() +
+                        ", topver=" + ring.topologyVersion();
+                    assert msg.topologyVersion() == ring.topologyVersion() : "msg: " + msg
+ ", topver=" + ring.topologyVersion();
 
                     notifyDiscoveryListener(msg);
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/271b7501/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 2b17696..7ca092c 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
@@ -17,7 +17,17 @@
 
 package org.apache.ignite.spi.discovery.tcp.internal;
 
-import java.util.ArrayList;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.P1;
+import org.apache.ignite.internal.util.typedef.PN;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.jetbrains.annotations.Nullable;
+
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -29,16 +39,6 @@ import java.util.TreeSet;
 import java.util.UUID;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.P1;
-import org.apache.ignite.internal.util.typedef.PN;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * Convenient way to represent topology for {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi}
@@ -81,6 +81,9 @@ public class TcpDiscoveryNodesRing {
     /** */
     private long nodeOrder;
 
+    /** */
+    private long maxInternalOrder;
+
     /** Lock. */
     @GridToStringExclude
     private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
@@ -99,6 +102,8 @@ public class TcpDiscoveryNodesRing {
             this.locNode = locNode;
 
             clear();
+
+            maxInternalOrder = locNode.internalOrder();
         }
         finally {
             rwLock.writeLock().unlock();
@@ -204,7 +209,9 @@ public class TcpDiscoveryNodesRing {
             if (nodesMap.containsKey(node.id()))
                 return false;
 
-            assert node.internalOrder() > maxInternalOrder() : "Adding node to the middle
of the ring " +
+            long maxInternalOrder0 = maxInternalOrder();
+
+            assert node.internalOrder() > maxInternalOrder0 : "Adding node to the middle
of the ring " +
                 "[ring=" + this + ", node=" + node + ']';
 
             nodesMap.put(node.id(), node);
@@ -216,6 +223,8 @@ public class TcpDiscoveryNodesRing {
             nodes.add(node);
 
             nodeOrder = node.internalOrder();
+
+            maxInternalOrder = node.internalOrder();
         }
         finally {
             rwLock.writeLock().unlock();
@@ -231,9 +240,13 @@ public class TcpDiscoveryNodesRing {
         rwLock.readLock().lock();
 
         try {
-            TcpDiscoveryNode last = nodes.last();
+            if (maxInternalOrder == 0) {
+                TcpDiscoveryNode last = nodes.last();
+
+                return last != null ? maxInternalOrder = last.internalOrder() : -1;
+            }
 
-            return last != null ? last.internalOrder() : -1;
+            return maxInternalOrder;
         }
         finally {
             rwLock.readLock().unlock();
@@ -336,47 +349,6 @@ public class TcpDiscoveryNodesRing {
     }
 
     /**
-     * Removes nodes from the topology.
-     *
-     * @param nodeIds IDs of the nodes to remove.
-     * @return Collection of removed nodes.
-     */
-    public Collection<TcpDiscoveryNode> removeNodes(Collection<UUID> nodeIds)
{
-        assert !F.isEmpty(nodeIds);
-
-        rwLock.writeLock().lock();
-
-        try {
-            boolean firstRmv = true;
-
-            Collection<TcpDiscoveryNode> res = null;
-
-            for (UUID id : nodeIds) {
-                TcpDiscoveryNode rmv = nodesMap.remove(id);
-
-                if (rmv != null) {
-                    if (firstRmv) {
-                        nodes = new TreeSet<>(nodes);
-
-                        res = new ArrayList<>(nodeIds.size());
-
-                        firstRmv = false;
-                    }
-
-                    nodes.remove(rmv);
-
-                    res.add(rmv);
-                }
-            }
-
-            return res == null ? Collections.<TcpDiscoveryNode>emptyList() : res;
-        }
-        finally {
-            rwLock.writeLock().unlock();
-        }
-    }
-
-    /**
      * Removes all remote nodes, leaves only local node.
      * <p>
      * This should be called when SPI should be disconnected from topology and
@@ -397,6 +369,7 @@ public class TcpDiscoveryNodesRing {
                 nodesMap.put(locNode.id(), locNode);
 
             nodeOrder = 0;
+            maxInternalOrder = 0;
 
             topVer = 0;
         }
@@ -622,13 +595,8 @@ public class TcpDiscoveryNodesRing {
         rwLock.writeLock().lock();
 
         try {
-            if (nodeOrder == 0) {
-                TcpDiscoveryNode last = nodes.last();
-
-                assert last != null;
-
-                nodeOrder = last.internalOrder();
-            }
+            if (nodeOrder == 0)
+                nodeOrder = maxInternalOrder();
 
             return ++nodeOrder;
         }
@@ -681,4 +649,4 @@ public class TcpDiscoveryNodesRing {
             rwLock.readLock().unlock();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/271b7501/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
index 7451911..18c8d8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
@@ -35,4 +35,4 @@ public class GridCacheValueConsistencyAtomicSelfTest extends GridCacheValueConsi
     @Override protected int iterationCount() {
         return 100_000;
     }
-}
\ No newline at end of file
+}


Mime
View raw message