ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: zk
Date Fri, 12 Jan 2018 13:03:03 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-zk a03ce53ed -> 364d68574


zk


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

Branch: refs/heads/ignite-zk
Commit: 364d685744f7371483720727a198e9e5cef3f002
Parents: a03ce53
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Jan 12 15:07:40 2018 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Jan 12 15:58:31 2018 +0300

----------------------------------------------------------------------
 .../IgniteClientReconnectCacheTest.java         |  2 +-
 .../discovery/zk/internal/ZkRuntimeState.java   |  3 ++
 .../zk/internal/ZookeeperDiscoveryImpl.java     | 37 ++++++++++++--------
 .../zk/ZookeeperDiscoverySpiTestSuite1.java     |  2 ++
 4 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/364d6857/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index b17e52b..4885769 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -701,7 +701,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         IgniteInternalFuture<Boolean> fut = GridTestUtils.runAsync(new Callable<Boolean>()
{
             @Override public Boolean call() throws Exception {
                 try {
-                    Ignition.start(optimize(getConfiguration(getTestIgniteInstanceName(SRV_CNT))));
+                    startGrid(optimize(getConfiguration(getTestIgniteInstanceName(SRV_CNT))));
 
                     // Commented due to IGNITE-4473, because
                     // IgniteClientDisconnectedException won't

http://git-wip-us.apache.org/repos/asf/ignite/blob/364d6857/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkRuntimeState.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkRuntimeState.java
b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkRuntimeState.java
index 6792154..cb04ac3 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkRuntimeState.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkRuntimeState.java
@@ -86,6 +86,9 @@ class ZkRuntimeState {
     /** Timeout callback to update processed events counter. */
     ZkTimeoutObject procEvtsUpdateTo;
 
+    /** */
+    boolean updateAlives;
+
     /**
      * @param prevJoined {@code True} if joined topology before reconnect attempt.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/364d6857/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
index c96c6cb..c1a904c 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
@@ -1558,6 +1558,12 @@ public class ZookeeperDiscoveryImpl {
         if (log.isInfoEnabled())
             log.info("Process alive nodes change [alives=" + aliveNodes.size() + "]");
 
+        if (rtState.updateAlives) {
+            aliveNodes = rtState.zkClient.getChildren(zkPaths.aliveNodesDir);
+
+            rtState.updateAlives = false;
+        }
+
         TreeMap<Long, String> alives = new TreeMap<>();
 
         for (String child : aliveNodes) {
@@ -1625,10 +1631,16 @@ public class ZookeeperDiscoveryImpl {
             handleProcessedEventsOnNodesFail(failedNodes);
     }
 
-   private void generateJoinEvents(TreeMap<Long, ZookeeperClusterNode> curTop,
+    /**
+     * @param curTop Current topology.
+     * @param alives Alive znodes.
+     * @param MAX_NEW_EVTS Max event to process.
+     * @throws Exception If failed.
+     */
+    private void generateJoinEvents(TreeMap<Long, ZookeeperClusterNode> curTop,
         TreeMap<Long, String> alives,
         final int MAX_NEW_EVTS) throws Exception
-   {
+    {
        ZkBulkJoinContext joinCtx = new ZkBulkJoinContext();
 
        for (Map.Entry<Long, String> e : alives.entrySet()) {
@@ -1668,7 +1680,7 @@ public class ZookeeperDiscoveryImpl {
 
        if (joinCtx.nodes() > 0)
            generateBulkJoinEvent(curTop, joinCtx);
-   }
+    }
 
     /**
      * @param curTop Current topology.
@@ -1869,13 +1881,13 @@ public class ZookeeperDiscoveryImpl {
     }
 
     /**
+     * @param joinCtx Joined nodes context.
      * @param curTop Current nodes.
      * @param internalId Joined node internal ID.
      * @param aliveNodePath Joined node path.
      * @throws Exception If failed.
-     * @return {@code True} if new join event was added.
      */
-    private boolean processJoinOnCoordinator(
+    private void processJoinOnCoordinator(
         ZkBulkJoinContext joinCtx,
         TreeMap<Long, ZookeeperClusterNode> curTop,
         long internalId,
@@ -1906,8 +1918,6 @@ public class ZookeeperDiscoveryImpl {
                     validateRes.secSubjZipBytes);
 
                 watchAliveNodeData(aliveNodePath);
-
-                return true;
             }
             else {
                 ZkInternalJoinErrorMessage joinErr = new ZkInternalJoinErrorMessage(
@@ -1915,16 +1925,12 @@ public class ZookeeperDiscoveryImpl {
                     validateRes.err);
 
                 processJoinError(aliveNodePath, nodeId, prefixId, joinErr);
-
-                return false;
             }
         }
         else {
             assert data instanceof ZkInternalJoinErrorMessage : data;
 
             processJoinError(aliveNodePath, nodeId, prefixId, (ZkInternalJoinErrorMessage)data);
-
-            return false;
         }
     }
 
@@ -2507,6 +2513,8 @@ public class ZookeeperDiscoveryImpl {
                 deleteAliveNode(failedNode.internalId());
 
                 handleProcessedEventsOnNodesFail(Collections.singletonList(failedNode));
+
+                rtState.updateAlives = true;
             }
         }
     }
@@ -2518,9 +2526,10 @@ public class ZookeeperDiscoveryImpl {
     private void deleteAliveNode(long internalId) throws Exception {
         for (String child : rtState.zkClient.getChildren(zkPaths.aliveNodesDir)) {
             if (ZkIgnitePaths.aliveInternalId(child) == internalId) {
-                rtState.zkClient.deleteIfExistsAsync(zkPaths.aliveNodesDir + "/" + child);
+                // Need use sync delete to do not process again join of this node again.
+                rtState.zkClient.deleteIfExists(zkPaths.aliveNodesDir + "/" + child, -1);
 
-                break;
+                return;
             }
         }
     }
@@ -2571,7 +2580,7 @@ public class ZookeeperDiscoveryImpl {
         assert !rtState.crd;
 
         // Need keep processed custom events since they contain message object which is needed
to create ack.
-        if (rtState.evtsData != null) {
+        if (!locNode.isClient() && rtState.evtsData != null) {
             for (Map.Entry<Long, ZkDiscoveryEventData> e : rtState.evtsData.evts.entrySet())
{
                 ZkDiscoveryEventData evtData = e.getValue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/364d6857/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestSuite1.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestSuite1.java
b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestSuite1.java
index 8e076f1..37e3bb3 100644
--- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestSuite1.java
+++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestSuite1.java
@@ -30,6 +30,8 @@ public class ZookeeperDiscoverySpiTestSuite1 extends TestSuite {
      * @throws Exception Thrown in case of the failure.
      */
     public static TestSuite suite() throws Exception {
+        System.setProperty("zookeeper.forceSync", "false");
+
         TestSuite suite = new TestSuite("ZookeeperDiscoverySpi Test Suite");
 
         suite.addTestSuite(ZookeeperClientTest.class);


Mime
View raw message