This is an automated email from the ASF dual-hosted git repository.

sergeychugunov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 50f43b4  IGNITE-13742 INACTIVE mode is forced on nodes in Maintenance 
Mode - Fixes #8524.
50f43b4 is described below

commit 50f43b48572ebd2cfd49578e425524bbd71f8a71
Author: ibessonov <bessonov...@gmail.com>
AuthorDate: Thu Dec 3 10:54:13 2020 +0300

    IGNITE-13742 INACTIVE mode is forced on nodes in Maintenance Mode - Fixes 
#8524.
    
    Signed-off-by: Sergey Chugunov <sergey.chugu...@gmail.com>
---
 .../java/org/apache/ignite/internal/IgniteKernal.java   | 17 ++++++++++++++++-
 .../processors/cluster/GridClusterStateProcessor.java   |  6 ++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 588ae7d..1bb3e6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1195,7 +1195,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
 
             // Assign discovery manager to context before other processors 
start so they
             // are able to register custom event listener.
-            GridManager discoMgr = new GridDiscoveryManager(ctx);
+            GridDiscoveryManager discoMgr = new GridDiscoveryManager(ctx);
 
             ctx.add(discoMgr, false);
 
@@ -1210,10 +1210,25 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
             startProcessor(mntcProcessor);
 
             if (mntcProcessor.isMaintenanceMode()) {
+                if (log.isInfoEnabled()) {
+                    log.info(
+                        "Node is being started in maintenance mode. " +
+                        "Starting IsolatedDiscoverySpi instead of configured 
discovery SPI."
+                    );
+                }
+
+                cfg.setClusterStateOnStart(ClusterState.INACTIVE);
+
+                if (log.isInfoEnabled())
+                    log.info("Overriding 'clusterStateOnStart' configuration 
to 'INACTIVE'.");
+
                 ctx.config().setDiscoverySpi(new IsolatedDiscoverySpi());
 
                 discoMgr = new GridDiscoveryManager(ctx);
 
+                // Reinitialized discovery manager won't have a valid 
consistentId on creation.
+                
discoMgr.consistentId(ctx.pdsFolderResolver().resolveFolders().consistentId());
+
                 ctx.add(discoMgr, false);
             }
 
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 faacc71..01ded97 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
@@ -1049,6 +1049,12 @@ public class GridClusterStateProcessor extends 
GridProcessorAdapter implements I
         boolean forceChangeBaselineTopology,
         boolean isAutoAdjust
     ) {
+        if (ctx.maintenanceRegistry().isMaintenanceMode()) {
+            return new GridFinishedFuture<>(
+                new IgniteCheckedException("Failed to " + prettyStr(state) + " 
(node is in maintenance mode).")
+            );
+        }
+
         BaselineTopology blt = (compatibilityMode && 
!forceChangeBaselineTopology) ?
             null :
             calculateNewBaselineTopology(state, baselineNodes, 
forceChangeBaselineTopology);

Reply via email to