IGNITE-8190 Print out an information message when local node is not in baseline

Signed-off-by: Andrey Gura <[email protected]>


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

Branch: refs/heads/ignite-6083
Commit: 25503ba1e36a2207469f0bcc91d9000607491926
Parents: f5a6525
Author: Aleksey Plekhanov <[email protected]>
Authored: Mon Apr 23 12:32:18 2018 +0300
Committer: Andrey Gura <[email protected]>
Committed: Mon Apr 23 12:32:49 2018 +0300

----------------------------------------------------------------------
 .../cluster/GridClusterStateProcessor.java      | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/25503ba1/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 2700a20..d4d0eb1 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
@@ -321,6 +321,9 @@ public class GridClusterStateProcessor extends 
GridProcessorAdapter implements I
     @Override @Nullable public IgniteInternalFuture<Boolean> 
onLocalJoin(DiscoCache discoCache) {
         final DiscoveryDataClusterState state = globalState;
 
+        if (state.active())
+            checkLocalNodeInBaseline(state.baselineTopology());
+
         if (state.transition()) {
             joinFut = new TransitionOnJoinWaitFuture(state, discoCache);
 
@@ -337,6 +340,23 @@ public class GridClusterStateProcessor extends 
GridProcessorAdapter implements I
     }
 
     /**
+     * Checks whether local node participating in Baseline Topology and warn 
if not.
+     */
+    private void checkLocalNodeInBaseline(BaselineTopology blt) {
+        if (blt == null || blt.consistentIds() == null || ctx.clientNode() || 
ctx.isDaemon())
+            return;
+
+        if (!CU.isPersistenceEnabled(ctx.config()))
+            return;
+
+        if 
(!blt.consistentIds().contains(ctx.discovery().localNode().consistentId())) {
+            U.quietAndInfo(log, "Local node is not included in Baseline 
Topology and will not be used " +
+                "for persistent data storage. Use control.(sh|bat) script or 
IgniteCluster interface to include " +
+                "the node to Baseline Topology.");
+        }
+    }
+
+    /**
      * Checks whether all conditions to meet BaselineTopology are satisfied.
      */
     private boolean isBaselineSatisfied(BaselineTopology blt, 
List<ClusterNode> serverNodes) {
@@ -1101,6 +1121,8 @@ public class GridClusterStateProcessor extends 
GridProcessorAdapter implements I
     private void onFinalActivate(final StateChangeRequest req) {
         ctx.dataStructures().onBeforeActivate();
 
+        checkLocalNodeInBaseline(globalState.baselineTopology());
+
         ctx.closure().runLocalSafe(new Runnable() {
             @Override public void run() {
                 boolean client = ctx.clientNode();

Reply via email to