Ian Maxon has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/3317

Change subject: [ASTERIXDB-2388] Add nodeIDs to cluster state query failure 
exception
......................................................................

[ASTERIXDB-2388] Add nodeIDs to cluster state query failure exception

Change-Id: I896fd0482e1db8a04dece058aa0975d3d961e731
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
1 file changed, 25 insertions(+), 10 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/17/3317/1

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
index 0eb8e0a..03aaf43 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
@@ -18,15 +18,13 @@
  */
 package org.apache.asterix.translator;
 
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.TimeUnit;
-
 import org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
+import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.cluster.IClusterStateManager;
 import org.apache.asterix.common.cluster.IGlobalRecoveryManager;
 import org.apache.asterix.common.dataflow.ICcApplicationContext;
 import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.ErrorCode;
 import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.lang.common.statement.DatasetDecl;
 import org.apache.asterix.lang.common.statement.DataverseDropStatement;
@@ -41,6 +39,12 @@
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Base class for language translators. Contains the common validation logic 
for language
@@ -68,12 +72,23 @@
                 }
                 Thread.currentThread().interrupt();
             }
-            if (!clusterStateManager.getState().equals(ClusterState.ACTIVE)) {
-                throw new AsterixException("Cluster is in " + 
ClusterState.UNUSABLE + " state."
-                        + "\n One or more Node Controllers have left or 
haven't joined yet.\n");
-            } else {
-                if (LOGGER.isInfoEnabled()) {
-                    LOGGER.info("Cluster is now " + ClusterState.ACTIVE);
+            synchronized (clusterStateManager) {
+                if 
(!clusterStateManager.getState().equals(ClusterState.ACTIVE)) {
+                    ClusterPartition[] configuredPartitions = 
clusterStateManager.getClusterPartitons();
+                    List<String> inactiveNodes = new ArrayList<>();
+                    for (ClusterPartition cp : configuredPartitions) {
+                        if (!cp.isActive()) {
+                            inactiveNodes.add(cp.getNodeId());
+                        }
+                    }
+                    throw 
AsterixException.create(ErrorCode.REJECT_BAD_CLUSTER_STATE,
+                            "Not all node controllers required for query 
execution" + " have joined the cluster. Nodes "
+                                    + inactiveNodes + " appear "
+                                    + "missing, double check the logs on these 
machines and the cluster configuration");
+                } else {
+                    if (LOGGER.isInfoEnabled()) {
+                        LOGGER.info("Cluster is now " + ClusterState.ACTIVE);
+                    }
                 }
             }
         }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/3317
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I896fd0482e1db8a04dece058aa0975d3d961e731
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ian Maxon <[email protected]>

Reply via email to