ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jok...@apache.org
Subject ignite git commit: IGNITE-10323 Don't run deactivation process on inactive cluster - Fixes #5476.
Date Fri, 23 Nov 2018 11:06:52 GMT
Repository: ignite
Updated Branches:
  refs/heads/master d45ea4b43 -> 39b59d21e


IGNITE-10323 Don't run deactivation process on inactive cluster - Fixes #5476.

Signed-off-by: Pavel Kovalenko <jokserfn@gmail.com>


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

Branch: refs/heads/master
Commit: 39b59d21e96bac51dca9a12702f1993ad96fead9
Parents: d45ea4b
Author: vd-pyatkov <vpyatkov@gridgain.com>
Authored: Fri Nov 23 14:05:46 2018 +0300
Committer: Pavel Kovalenko <jokserfn@gmail.com>
Committed: Fri Nov 23 14:05:46 2018 +0300

----------------------------------------------------------------------
 .../cluster/GridClusterStateProcessor.java      |  3 +-
 ...erActivateDeactivateTestWithPersistence.java | 37 ++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/39b59d21/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 6d5d474..95ff770 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
@@ -849,7 +849,8 @@ public class GridClusterStateProcessor extends GridProcessorAdapter implements
I
 
         DiscoveryDataClusterState curState = globalState;
 
-        if (!curState.transition() && curState.active() == activate && BaselineTopology.equals(curState.baselineTopology(),
blt))
+        if (!curState.transition() && curState.active() == activate
+            && (!activate || BaselineTopology.equals(curState.baselineTopology(),
blt)))
             return new GridFinishedFuture<>();
 
         GridChangeGlobalStateFuture startedFut = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/39b59d21/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
index 0972ea2..4dc4f27 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
@@ -98,6 +98,43 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends
IgniteCl
         activateCachesRestore(5, true);
     }
 
+    /**
+     * Test deactivation on cluster that is not yet activated.
+     *
+     * @throws Exception If failed.
+     */
+    public void testDeactivateInactiveCluster() throws Exception {
+        ccfgs = new CacheConfiguration[] {
+            new CacheConfiguration<>("test_cache_1")
+                .setGroupName("test_cache"),
+            new CacheConfiguration<>("test_cache_2")
+                .setGroupName("test_cache")
+        };
+
+        Ignite ignite = startGrids(3);
+
+        ignite.cluster().active(true);
+
+        ignite.cache("test_cache_1")
+            .put("key1", "val1");
+        ignite.cache("test_cache_2")
+            .put("key1", "val1");
+
+        ignite.cluster().active(false);
+
+        assertFalse(ignite.cluster().active());
+
+        stopAllGrids();
+
+        ignite = startGrids(2);
+
+        assertFalse(ignite.cluster().active());
+
+        ignite.cluster().active(false);
+
+        assertFalse(ignite.cluster().active());
+    }
+
     /** */
     private Map<Integer, Integer> startGridsAndLoadData(int srvs) throws Exception
{
         Ignite srv = startGrids(srvs);


Mime
View raw message