asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Maxon (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Fix ASTERIXDB-1089
Date Thu, 26 Nov 2015 06:03:19 GMT
Ian Maxon has submitted this change and it was merged.

Change subject: Fix ASTERIXDB-1089
......................................................................


Fix ASTERIXDB-1089

This fixes a case where an NPE is thrown when a substitute node joins but
no substitute nodes are specified in the cluster config

Change-Id: I8977d91ea82cd3a0538a84dc6d727d94fe2ece1d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/508
Reviewed-by: Till Westmann <tillw@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>
Reviewed-by: Keren-Audrey Ouaknine <kereno@gmail.com>
---
M asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
1 file changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Keren-Audrey Ouaknine: Looks good to me, but someone else must approve
  Murtadha Hubail: Looks good to me, approved
  Till Westmann: Looks good to me, but someone else must approve
  Jenkins: Verified



diff --git a/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
b/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index 490f42b..2cd6a1a 100644
--- a/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.rmi.server.UnicastRemoteObject;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -38,6 +39,7 @@
 import org.apache.asterix.common.transactions.IRecoveryManager.SystemState;
 import org.apache.asterix.event.schema.cluster.Cluster;
 import org.apache.asterix.event.schema.cluster.Node;
+import org.apache.asterix.event.schema.cluster.SubstituteNodes;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataNode;
 import org.apache.asterix.metadata.api.IAsterixStateProxy;
@@ -295,11 +297,20 @@
         if (!metadataProperties.getNodeNames().contains(nodeId)) {
             metadataProperties.getNodeNames().add(nodeId);
             Cluster cluster = AsterixClusterProperties.INSTANCE.getCluster();
+            if (cluster == null) {
+                throw new IllegalStateException("No cluster configuration found for this
instance");
+            }
             String asterixInstanceName = cluster.getInstanceName();
             AsterixTransactionProperties txnProperties = ((IAsterixPropertiesProvider) runtimeContext)
                     .getTransactionProperties();
             Node self = null;
-            for (Node node : cluster.getSubstituteNodes().getNode()) {
+            List<Node> nodes;
+            if (cluster.getSubstituteNodes() != null) {
+                nodes = cluster.getSubstituteNodes().getNode();
+            } else {
+                throw new IllegalStateException("Unknown node joining the cluster");
+            }
+            for (Node node : nodes) {
                 String ncId = asterixInstanceName + "_" + node.getId();
                 if (ncId.equalsIgnoreCase(nodeId)) {
                     String storeDir = node.getStore() == null ? cluster.getStore() : node.getStore();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8977d91ea82cd3a0538a84dc6d727d94fe2ece1d
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ian Maxon <imaxon@apache.org>
Gerrit-Reviewer: Ian Maxon <imaxon@apache.org>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Keren-Audrey Ouaknine <kereno@gmail.com>
Gerrit-Reviewer: Murtadha Hubail <hubailmor@gmail.com>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message