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 Wed, 22 Nov 2017 12:45:25 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-zk bc297aa4b -> 4749d332c


zk


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

Branch: refs/heads/ignite-zk
Commit: 4749d332c7ec1b6d24f8a8d0f6d5abf50de5d71d
Parents: bc297aa
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Nov 22 14:27:47 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Nov 22 15:45:19 2017 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |  2 +-
 ...niteCacheDistributedQueryCancelSelfTest.java |  2 +-
 .../zk/internal/ZkDiscoveryCustomEventData.java |  2 +-
 .../zk/internal/ZookeeperDiscoveryImpl.java     | 18 +++++---
 .../ZookeeperDiscoverySpiBasicTest.java         | 48 ++++++++++++++++++++
 5 files changed, 62 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4749d332/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index d70c548..e15df60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -474,7 +474,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
 
     /** {@inheritDoc} */
     @Override protected void onKernalStart0() throws IgniteCheckedException {
-        if (Boolean.TRUE.equals(ctx.config().isClientMode()) && !getSpi().isClientMode())
+        if ((getSpi() instanceof TcpDiscoverySpi) && Boolean.TRUE.equals(ctx.config().isClientMode())
&& !getSpi().isClientMode())
             ctx.performance().add("Enable client mode for TcpDiscoverySpi " +
                 "(set TcpDiscoverySpi.forceServerMode to false)");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/4749d332/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
index b9ef1e4..e26b211 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
@@ -117,7 +117,7 @@ public class IgniteCacheDistributedQueryCancelSelfTest extends GridCommonAbstrac
                     }
 
                     for (Ignite g : G.allGrids())
-                        if (!g.configuration().getDiscoverySpi().isClientMode())
+                        if (!g.configuration().isClientMode())
                             stopGrid(g.name(), true);
                 }
             }, 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4749d332/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
index 5668428..70e25c7 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
@@ -63,6 +63,6 @@ class ZkDiscoveryCustomEventData extends ZkDiscoveryEventData {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "CustomEventData [topVer=" + topologyVersion() + ", sndNode=" + sndNodeId
+ ']';
+        return "ZkDiscoveryCustomEventData [topVer=" + topologyVersion() + ", evtId=" + eventId()
+ ", sndNode=" + sndNodeId + ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/4749d332/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 11c6a6e..1466872 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
@@ -483,10 +483,10 @@ public class ZookeeperDiscoveryImpl {
      * @throws Exception If failed.
      */
     private void onBecomeCoordinator(List<String> aliveNodes, int locInternalId) throws
Exception {
-        byte[] evtsData = zkClient.getData(zkPaths.evtsPath);
+        byte[] evtsDataBytes = zkClient.getData(zkPaths.evtsPath);
 
-        if (evtsData.length > 0)
-            processNewEvents(evtsData);
+        if (evtsDataBytes.length > 0)
+            processNewEvents(evtsDataBytes);
 
         crd = true;
 
@@ -497,7 +497,7 @@ public class ZookeeperDiscoveryImpl {
             assert locNode.order() > 0 : locNode;
             assert this.evtsData != null;
 
-            Iterator<ZkDiscoveryEventData> it = this.evtsData.evts.values().iterator();
+            Iterator<ZkDiscoveryEventData> it = evtsData.evts.values().iterator();
 
             while (it.hasNext()) {
                 ZkDiscoveryEventData evtData = it.next();
@@ -914,11 +914,15 @@ public class ZookeeperDiscoveryImpl {
 
         assert !crd;
 
-        ZkDiscoveryEventsData evtsData = unmarshal(data);
+        ZkDiscoveryEventsData newEvtsData = unmarshal(data);
 
-        processNewEvents(evtsData);
+        // Need keep processed custom events since they contains message object.
+        if (evtsData != null)
+            newEvtsData.evts.putAll(evtsData.evts);
+
+        processNewEvents(newEvtsData);
 
-        this.evtsData = evtsData;
+        this.evtsData = newEvtsData;
     }
 
     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/4749d332/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java
b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java
index 13e4ace..c481b3d 100644
--- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java
+++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java
@@ -231,6 +231,54 @@ public class ZookeeperDiscoverySpiBasicTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If failed.
      */
+    public void testClientNodesStatus() throws Exception {
+        startGrid(0);
+
+        for (Ignite node : G.allGrids()) {
+            assertEquals(0, node.cluster().forClients().nodes().size());
+            assertEquals(1, node.cluster().forServers().nodes().size());
+        }
+
+        client = true;
+
+        startGrid(1);
+
+        for (Ignite node : G.allGrids()) {
+            assertEquals(1, node.cluster().forClients().nodes().size());
+            assertEquals(1, node.cluster().forServers().nodes().size());
+        }
+
+        client = false;
+
+        startGrid(2);
+
+        client = true;
+
+        startGrid(3);
+
+        for (Ignite node : G.allGrids()) {
+            assertEquals(2, node.cluster().forClients().nodes().size());
+            assertEquals(2, node.cluster().forServers().nodes().size());
+        }
+
+        stopGrid(1);
+
+        for (Ignite node : G.allGrids()) {
+            assertEquals(1, node.cluster().forClients().nodes().size());
+            assertEquals(2, node.cluster().forServers().nodes().size());
+        }
+
+        stopGrid(2);
+
+        for (Ignite node : G.allGrids()) {
+            assertEquals(1, node.cluster().forClients().nodes().size());
+            assertEquals(1, node.cluster().forServers().nodes().size());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testStopNode_1() throws Exception {
         startGrids(5);
 


Mime
View raw message