ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [6/6] ignite git commit: ignite-gg-12389
Date Tue, 04 Jul 2017 09:15:17 GMT
ignite-gg-12389


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

Branch: refs/heads/ignite-gg-12389
Commit: ef13dfadd856d8e19a5bc7eeae47767f79b1c5e1
Parents: a9e1753
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Jul 4 11:50:11 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Jul 4 12:13:35 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java          |  2 +-
 .../processors/cache/ClusterCachesInfo.java        |  4 +++-
 .../cache/DynamicCacheChangeRequest.java           | 17 +++++++++++++++++
 .../cluster/GridClusterStateProcessor.java         | 14 +++++++-------
 .../ignite/spi/discovery/tcp/ClientImpl.java       | 13 +++++++------
 .../cache/IgniteClusterActivateDeactivateTest.java |  3 +++
 .../testframework/junits/GridAbstractTest.java     |  4 ++--
 7 files changed, 40 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 2bf7838..6f7f4c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -710,7 +710,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
 
             NearCacheConfiguration nearCfg = null;
 
-            if (cctx.localNodeId().equals(req.initiatingNodeId()) && !exchActions.activate())
{
+            if (req.locallyConfigured() || (cctx.localNodeId().equals(req.initiatingNodeId())
&& !exchActions.activate())) {
                 startCache = true;
 
                 nearCfg = req.nearCacheConfiguration();

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index ab24814..a0a29d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -1083,7 +1083,7 @@ class ClusterCachesInfo {
 
                 DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(msg.requestId(),
                     desc.cacheName(),
-                    locCfg != null ? ctx.localNodeId() : null);
+                    msg.initiatorNodeId());
 
                 req.startCacheConfiguration(desc.cacheConfiguration());
                 req.cacheType(desc.cacheType());
@@ -1093,6 +1093,8 @@ class ClusterCachesInfo {
                         req.startCacheConfiguration(locCfg.get1());
 
                     req.nearCacheConfiguration(locCfg.get2());
+
+                    req.locallyConfigured(true);
                 }
 
                 exchangeActions.addCacheToStart(req, desc);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index f2fce18..2fd8780 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -89,6 +89,9 @@ public class DynamicCacheChangeRequest implements Serializable {
     /** Dynamic schema. */
     private QuerySchema schema;
 
+    /** */
+    private transient boolean locallyConfigured;
+
     /**
      * @param reqId Unique request ID.
      * @param cacheName Cache stop name.
@@ -387,6 +390,20 @@ public class DynamicCacheChangeRequest implements Serializable {
         this.schema = schema != null ? schema.copy() : null;
     }
 
+    /**
+     * @return Locally configured flag.
+     */
+    public boolean locallyConfigured() {
+        return locallyConfigured;
+    }
+
+    /**
+     * @param locallyConfigured Locally configured flag.
+     */
+    public void locallyConfigured(boolean locallyConfigured) {
+        this.locallyConfigured = locallyConfigured;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return "DynamicCacheChangeRequest [cacheName=" + cacheName() +

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 9e1ddfb..c262a3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -98,12 +98,13 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
 
             final GridChangeGlobalStateFuture f = stateChangeFut.get();
 
-            if (f != null)
+            if (f != null) {
                 f.initFut.listen(new CI1<IgniteInternalFuture<?>>() {
                     @Override public void apply(IgniteInternalFuture<?> fut) {
-                        f.onDiscoveryEvent(e);
+                        f.onNodeLeft(e);
                     }
                 });
+            }
         }
     };
 
@@ -220,9 +221,6 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
         }
         else {
             if (globalState.active() != msg.activate()) {
-//                if (!ctx.localNodeId().equals(msg.initiatorNodeId()))
-//                    stateChangeFut.compareAndSet(null, new GridChangeGlobalStateFuture(msg.requestId(),
msg.activate(), ctx));
-// TODO GG-12389
                 Set<UUID> nodeIds = U.newHashSet(discoCache.allNodes().size());
 
                 for (ClusterNode node : discoCache.allNodes())
@@ -691,7 +689,9 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
         private final IgniteLogger log;
 
         /**
-         *
+         * @param requestId State change request ID.
+         * @param activate New cluster state.
+         * @param ctx Context.
          */
         GridChangeGlobalStateFuture(UUID requestId, boolean activate, GridKernalContext ctx)
{
             this.requestId = requestId;
@@ -704,7 +704,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
         /**
          * @param event Event.
          */
-        void onDiscoveryEvent(DiscoveryEvent event) {
+        void onNodeLeft(DiscoveryEvent event) {
             assert event != null;
 
             if (isDone())

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/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 0bc1239..5dbfe6e 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
@@ -484,8 +484,6 @@ class ClientImpl extends TcpDiscoveryImpl {
 
         long startTime = U.currentTimeMillis();
 
-        DiscoveryDataPacket discoveryData = recon ? null : spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId()));
-
         while (true) {
             if (Thread.currentThread().isInterrupted())
                 throw new InterruptedException();
@@ -523,7 +521,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                 InetSocketAddress addr = it.next();
 
-                T3<SocketStream, Integer, Boolean> sockAndRes = sendJoinRequest(recon,
addr, discoveryData);
+                T3<SocketStream, Integer, Boolean> sockAndRes = sendJoinRequest(recon,
addr);
 
                 if (sockAndRes == null) {
                     it.remove();
@@ -582,12 +580,10 @@ class ClientImpl extends TcpDiscoveryImpl {
     /**
      * @param recon {@code True} if reconnects.
      * @param addr Address.
-     * @param discoveryData Discovery data.
      * @return Socket, connect response and client acknowledge support flag.
      */
     @Nullable private T3<SocketStream, Integer, Boolean> sendJoinRequest(boolean recon,
-        InetSocketAddress addr,
-        DiscoveryDataPacket discoveryData) {
+        InetSocketAddress addr) {
         assert addr != null;
 
         if (log.isDebugEnabled())
@@ -608,6 +604,8 @@ class ClientImpl extends TcpDiscoveryImpl {
 
         IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi,
true);
 
+        DiscoveryDataPacket discoveryData = null;
+
         while (true) {
             boolean openSock = false;
 
@@ -650,6 +648,9 @@ class ClientImpl extends TcpDiscoveryImpl {
                         marshalCredentials(node);
                     }
 
+                    if (discoveryData == null)
+                        discoveryData = spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId()));
+
                     msg = new TcpDiscoveryJoinRequestMessage(node, discoveryData);
                 }
                 else

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index 894bd3e..a9deeed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.TestRecordingCommunicationSpi;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -191,6 +192,8 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
         for (int i = 0; i < srvs + clients; i++) {
             for (int c = 0; c < 2; c++)
                 checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+
+            checkCache(ignite(i), CU.UTILITY_CACHE_NAME, true);
         }
 
         checkCaches(srvs + clients, CACHES);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef13dfad/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index a9a870e..d6d241c 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -2099,13 +2099,13 @@ public abstract class GridAbstractTest extends TestCase {
         for (Ignite g : G.allGrids()) {
             final GridKernalContext ctx = ((IgniteKernal)g).context();
 
-            if (ctx.isStopping())
+            if (ctx.isStopping() || !g.active())
                 continue;
 
             AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
             AffinityTopologyVersion exchVer = ctx.cache().context().exchange().readyAffinityVersion();
 
-            if (! topVer.equals(exchVer)) {
+            if (!topVer.equals(exchVer)) {
                 info("Topology version mismatch [node="  + g.name() +
                     ", exchVer=" + exchVer +
                     ", topVer=" + topVer + ']');


Mime
View raw message