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[release-0.8.8]: Fix ASTERIXDB-1089
Date Tue, 24 Nov 2015 22:32:44 GMT
Ian Maxon has uploaded a new change for review.

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

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
---
M asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
1 file changed, 18 insertions(+), 15 deletions(-)


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

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..6b58d35 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;
@@ -59,11 +61,9 @@
 public class NCApplicationEntryPoint implements INCApplicationEntryPoint {
     private static final Logger LOGGER = Logger.getLogger(NCApplicationEntryPoint.class.getName());
 
-    @Option(name = "-metadata-port", usage = "IP port to bind metadata listener (default:
random port)", required = false)
-    public int metadataRmiPort = 0;
+    @Option(name = "-metadata-port", usage = "IP port to bind metadata listener (default:
random port)", required = false) public int metadataRmiPort = 0;
 
-    @Option(name = "-initial-run", usage = "A flag indicating if it's the first time the
NC is started (default: false)", required = false)
-    public boolean initialRun = false;
+    @Option(name = "-initial-run", usage = "A flag indicating if it's the first time the
NC is started (default: false)", required = false) public boolean initialRun = false;
 
     private INCApplicationContext ncApplicationContext = null;
     private IAsterixAppRuntimeContext runtimeContext;
@@ -74,8 +74,7 @@
     private boolean performedRemoteRecovery = false;
     private boolean replicationEnabled = false;
 
-    @Override
-    public void start(INCApplicationContext ncAppCtx, String[] args) throws Exception {
+    @Override public void start(INCApplicationContext ncAppCtx, String[] args) throws Exception
{
         CmdLineParser parser = new CmdLineParser(this);
 
         try {
@@ -161,8 +160,7 @@
         runtimeContext.getReplicationManager().startReplicationThreads();
     }
 
-    @Override
-    public void stop() throws Exception {
+    @Override public void stop() throws Exception {
         if (!stopInitiated) {
             runtimeContext.setShuttingdown(true);
             stopInitiated = true;
@@ -187,8 +185,7 @@
         }
     }
 
-    @Override
-    public void notifyStartupComplete() throws Exception {
+    @Override public void notifyStartupComplete() throws Exception {
         AsterixMetadataProperties metadataProperties = ((IAsterixPropertiesProvider) runtimeContext)
                 .getMetadataProperties();
 
@@ -248,8 +245,8 @@
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Configured:" + lccm);
         }
-        ncApplicationContext.setStateDumpHandler(new AsterixStateDumpHandler(ncApplicationContext.getNodeId(),
lccm
-                .getDumpPath(), lccm));
+        ncApplicationContext.setStateDumpHandler(
+                new AsterixStateDumpHandler(ncApplicationContext.getNodeId(), lccm.getDumpPath(),
lccm));
 
         lccm.startAll();
 
@@ -279,8 +276,8 @@
                 .get(nodeId)[0];
 
         for (String mountPoint : storageMountingPoints) {
-            String tempDatasetFolder = mountPoint + storageFolderName + File.separator
-                    + AqlMetadataProvider.TEMP_DATASETS_STORAGE_FOLDER;
+            String tempDatasetFolder =
+                    mountPoint + storageFolderName + File.separator + AqlMetadataProvider.TEMP_DATASETS_STORAGE_FOLDER;
             AsterixFilesUtil.deleteFolder(tempDatasetFolder);
         }
 
@@ -299,7 +296,13 @@
             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/517
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8977d91ea82cd3a0538a84dc6d727d94fe2ece1d
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.8.8
Gerrit-Owner: Ian Maxon <imaxon@apache.org>

Mime
View raw message