Repository: asterixdb
Updated Branches:
  refs/heads/master cc7d2f0ce -> 5dcf139e5


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-server/src/test/resources/transactionts/testsuite.xml
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-server/src/test/resources/transactionts/testsuite.xml 
b/asterixdb/asterix-server/src/test/resources/transactionts/testsuite.xml
new file mode 100644
index 0000000..38179b2
--- /dev/null
+++ b/asterixdb/asterix-server/src/test/resources/transactionts/testsuite.xml
@@ -0,0 +1,219 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<test-suite xmlns="urn:xml.testframework.asterix.apache.org" 
ResultOffsetPath="results" QueryOffsetPath="queries" QueryFileExtension=".aql">
+  <test-group name="query_after_restart">
+    <test-case FilePath="query_after_restart">
+      <compilation-unit name="dataset-with-meta-record">
+        <output-dir compare="Text">dataset-with-meta-record</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="query_after_restart">
+      <compilation-unit name="external_index">
+        <output-dir compare="Text">external_index</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="query_after_restart">
+      <compilation-unit name="big_object_20M">
+        <output-dir compare="Text">big_object_20M</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+  <test-group name="dml_after_restart">
+    <test-case FilePath="dml_after_restart">
+      <compilation-unit name="multiple_secondary_indices">
+        <output-dir compare="Text">multiple_secondary_indices</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+  <test-group name="recover_after_abort">
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_index_only">
+        <output-dir compare="Text">primary_index_only</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_default_secondary_index">
+        <output-dir 
compare="Text">primary_plus_default_secondary_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_default_correlated_secondary_index">
+        <output-dir 
compare="Text">primary_plus_default_secondary_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_rtree_index">
+        <output-dir compare="Text">primary_plus_rtree_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_correlated_rtree_index">
+        <output-dir compare="Text">primary_plus_rtree_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_rtree_index_insert_and_delete">
+        <output-dir 
compare="Text">primary_plus_rtree_index_insert_and_delete</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_keyword_secondary_index">
+        <output-dir 
compare="Text">primary_plus_keyword_secondary_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_keyword_correlated_secondary_index">
+        <output-dir 
compare="Text">primary_plus_keyword_secondary_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_ngram_index">
+        <output-dir compare="Text">primary_plus_ngram_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_correlated_ngram_index">
+        <output-dir compare="Text">primary_plus_ngram_index</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_multiple_secondary_indices">
+        <output-dir 
compare="Text">primary_plus_multiple_secondary_indices</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit 
name="primary_plus_multiple_correlated_secondary_indices">
+        <output-dir 
compare="Text">primary_plus_multiple_secondary_indices</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_index_only_filtered">
+        <output-dir compare="Text">primary_index_only_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_default_secondary_index_filtered">
+        <output-dir 
compare="Text">primary_plus_default_secondary_index_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_rtree_index_filtered">
+        <output-dir 
compare="Text">primary_plus_rtree_index_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit 
name="primary_plus_rtree_index_insert_and_delete_filtered">
+        <output-dir 
compare="Text">primary_plus_rtree_index_insert_and_delete_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_keyword_secondary_index_filtered">
+        <output-dir 
compare="Text">primary_plus_keyword_secondary_index_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_ngram_index">
+        <output-dir 
compare="Text">primary_plus_ngram_index_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_multiple_secondary_indices">
+        <output-dir 
compare="Text">primary_plus_multiple_secondary_indices_filtered</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recover_after_abort">
+      <compilation-unit name="primary_plus_multiple_secondary_indices"><!-- 
The only exception here is during the kill command which is in a different JVM, 
hence not caught -->
+        <output-dir 
compare="Text">primary_plus_multiple_secondary_indices</output-dir>
+        <!-- 
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException</expected-error>
 -->
+      </compilation-unit>
+    </test-case>
+  </test-group>
+
+  <test-group name="recovery_ddl">
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="dataverse_recovery">
+        <output-dir compare="Text">dataverse_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="datatype_recovery">
+        <output-dir compare="Text">datatype_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="dataset_recovery">
+        <output-dir compare="Text">dataset_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="secondary_index_recovery">
+        <output-dir compare="Text">secondary_index_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="load_after_recovery">
+        <output-dir compare="Text">load_after_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="insert_after_recovery">
+        <output-dir compare="Text">insert_after_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="delete_after_recovery">
+        <output-dir compare="Text">delete_after_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+
+    <test-case FilePath="recovery_ddl">
+      <compilation-unit name="function_recovery">
+        <output-dir compare="Text">function_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+
+</test-suite>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
 
b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
index ba43fb7..601dec3 100644
--- 
a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
+++ 
b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
@@ -126,6 +126,7 @@ public class PersistentLocalResourceRepository implements 
ILocalResourceReposito
         //initially the node active partitions are the same as the original 
partitions
         nodeOriginalPartitions = new HashSet<>(nodePartitions.length);
         nodeActivePartitions = new HashSet<>(nodePartitions.length);
+        nodeInactivePartitions = new HashSet<>(nodePartitions.length);
         for (ClusterPartition partition : nodePartitions) {
             nodeOriginalPartitions.add(partition.getPartitionId());
             nodeActivePartitions.add(partition.getPartitionId());
@@ -169,8 +170,8 @@ public class PersistentLocalResourceRepository implements 
ILocalResourceReposito
             throw HyracksDataException.create(CANNOT_CREATE_FILE, 
parent.getAbsolutePath());
         }
 
-        try (FileOutputStream fos = new FileOutputStream(
-                resourceFile.getFile()); ObjectOutputStream oosToFos = new 
ObjectOutputStream(fos)) {
+        try (FileOutputStream fos = new 
FileOutputStream(resourceFile.getFile());
+                ObjectOutputStream oosToFos = new ObjectOutputStream(fos)) {
             oosToFos.writeObject(resource);
             oosToFos.flush();
         } catch (IOException e) {
@@ -200,8 +201,8 @@ public class PersistentLocalResourceRepository implements 
ILocalResourceReposito
             resourceCache.invalidate(relativePath);
             IoUtil.delete(resourceFile);
         } else {
-            throw HyracksDataException
-                    
.create(org.apache.hyracks.api.exceptions.ErrorCode.RESOURCE_DOES_NOT_EXIST, 
relativePath);
+            throw 
HyracksDataException.create(org.apache.hyracks.api.exceptions.ErrorCode.RESOURCE_DOES_NOT_EXIST,
+                    relativePath);
         }
     }
 
@@ -242,14 +243,13 @@ public class PersistentLocalResourceRepository implements 
ILocalResourceReposito
     }
 
     private static String getFileName(String path) {
-        return path.endsWith(File.separator) ?
-                (path + StorageConstants.METADATA_FILE_NAME) :
-                (path + File.separator + StorageConstants.METADATA_FILE_NAME);
+        return path.endsWith(File.separator) ? (path + 
StorageConstants.METADATA_FILE_NAME)
+                : (path + File.separator + 
StorageConstants.METADATA_FILE_NAME);
     }
 
     public static LocalResource readLocalResource(File file) throws 
HyracksDataException {
-        try (FileInputStream fis = new FileInputStream(file); 
ObjectInputStream oisFromFis = new ObjectInputStream(
-                fis)) {
+        try (FileInputStream fis = new FileInputStream(file);
+                ObjectInputStream oisFromFis = new ObjectInputStream(fis)) {
             LocalResource resource = (LocalResource) oisFromFis.readObject();
             if (resource.getVersion() == ITreeIndexFrame.Constants.VERSION) {
                 return resource;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
 
b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
index 3f94749..99f365a 100644
--- 
a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
+++ 
b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
@@ -34,12 +34,11 @@ import org.apache.asterix.common.transactions.LogType;
 public class LogManagerWithReplication extends LogManager {
 
     private IReplicationManager replicationManager;
-    private final IReplicationStrategy replicationStrategy;
+    private IReplicationStrategy replicationStrategy;
     private final Set<Long> replicatedTxn = ConcurrentHashMap.newKeySet();
 
-    public LogManagerWithReplication(ITransactionSubsystem txnSubsystem, 
IReplicationStrategy replicationStrategy) {
+    public LogManagerWithReplication(ITransactionSubsystem txnSubsystem) {
         super(txnSubsystem);
-        this.replicationStrategy = replicationStrategy;
     }
 
     @Override
@@ -144,6 +143,7 @@ public class LogManagerWithReplication extends LogManager {
     @Override
     public void setReplicationManager(IReplicationManager replicationManager) {
         this.replicationManager = replicationManager;
+        this.replicationStrategy = replicationManager.getReplicationStrategy();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index b968fcc..32a5d1b 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -150,7 +150,9 @@
           <excludes combine.children="append">
             <exclude>src/main/licenses/**</exclude>
             <exclude>**/*.iml</exclude>
+            <exclude>**/*.json</exclude>
             <exclude>**/*.adm</exclude>
+            <exclude>**/*.template</exclude>
             <exclude>asterix-installer/**</exclude> <!-- in case 
-DskipInstaller -->
           </excludes>
         </configuration>
@@ -680,17 +682,6 @@
         </plugins>
       </build>
     </profile>
-    <profile>
-      <id>include-managix</id>
-      <activation>
-        <property>
-          <name>!skipManagix</name>
-        </property>
-      </activation>
-      <modules>
-        <module>asterix-installer</module>
-      </modules>
-    </profile>
   </profiles>
 
   <modules>
@@ -711,7 +702,6 @@
     <module>asterix-test-framework</module>
     <module>asterix-maven-plugins</module>
     <module>asterix-server</module>
-    <module>asterix-events</module>
     <module>asterix-doc</module>
     <module>asterix-fuzzyjoin</module>
     <module>asterix-replication</module>
@@ -720,6 +710,7 @@
     <module>asterix-active</module>
     <module>asterix-client-helper</module>
     <module>asterix-license</module>
+    <module>asterix-installer</module>
   </modules>
 
   <dependencyManagement>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/ICCApplication.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/ICCApplication.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/ICCApplication.java
index d4269d5..6bcdd8a 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/ICCApplication.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/ICCApplication.java
@@ -18,10 +18,12 @@
  */
 package org.apache.hyracks.api.application;
 
+import org.apache.hyracks.api.config.IConfigManager;
 import org.apache.hyracks.api.job.resource.IJobCapacityController;
 
 public interface ICCApplication extends IApplication {
 
     IJobCapacityController getJobCapacityController();
 
+    IConfigManager getConfigManager();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
index 5ea51d1..b2478a3 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/BaseCCApplication.java
@@ -35,6 +35,7 @@ import org.apache.hyracks.control.common.controllers.NCConfig;
 public class BaseCCApplication implements ICCApplication {
     private static final Logger LOGGER = 
Logger.getLogger(BaseCCApplication.class.getName());
     public static final ICCApplication INSTANCE = new BaseCCApplication();
+    private IConfigManager configManager;
 
     protected BaseCCApplication() {
     }
@@ -68,6 +69,7 @@ public class BaseCCApplication implements ICCApplication {
 
     @Override
     public void registerConfig(IConfigManager configManager) {
+        this.configManager = configManager;
         configManager.addIniParamOptions(ControllerConfig.Option.CONFIG_FILE, 
ControllerConfig.Option.CONFIG_FILE_URL);
         configManager.addCmdLineSections(Section.CC, Section.COMMON);
         configManager.setUsageFilter(getUsageFilter());
@@ -84,4 +86,9 @@ public class BaseCCApplication implements ICCApplication {
         Logger.getLogger("org.apache.hyracks").setLevel(level);
     }
 
+    @Override
+    public IConfigManager getConfigManager() {
+        return configManager;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
index 713bddd..fd53c25 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/ClusterControllerService.java
@@ -171,8 +171,8 @@ public class ClusterControllerService implements 
IControllerService {
         final ClusterTopology topology = computeClusterTopology(ccConfig);
         ccContext = new ClusterControllerContext(topology);
         sweeper = new DeadNodeSweeper();
-        datasetDirectoryService =
-                new DatasetDirectoryService(ccConfig.getResultTTL(), 
ccConfig.getResultSweepThreshold());
+        datasetDirectoryService = new 
DatasetDirectoryService(ccConfig.getResultTTL(),
+                ccConfig.getResultSweepThreshold());
 
         deploymentRunMap = new HashMap<>();
         stateDumpRunMap = new HashMap<>();
@@ -270,8 +270,8 @@ public class ClusterControllerService implements 
IControllerService {
 
     private void connectNCs() {
         getNCServices().forEach((key, value) -> {
-            final TriggerNCWork triggerWork = new 
TriggerNCWork(ClusterControllerService.this,
-                    value.getLeft(), value.getRight(), key);
+            final TriggerNCWork triggerWork = new 
TriggerNCWork(ClusterControllerService.this, value.getLeft(),
+                    value.getRight(), key);
             executor.submit(triggerWork);
         });
         serviceCtx.addClusterLifecycleListener(new IClusterLifecycleListener() 
{
@@ -284,18 +284,22 @@ public class ClusterControllerService implements 
IControllerService {
             @Override
             public void notifyNodeFailure(Collection<String> deadNodeIds) 
throws HyracksException {
                 LOGGER.log(Level.WARNING, "Getting notified that nodes: " + 
deadNodeIds + " has failed");
-                for (String nodeId : deadNodeIds) {
-                    Pair<String, Integer> ncService = getNCService(nodeId);
-                    if (ncService.getRight() != 
NCConfig.NCSERVICE_PORT_DISABLED) {
-                        final TriggerNCWork triggerWork = new 
TriggerNCWork(ClusterControllerService.this,
-                                ncService.getLeft(), ncService.getRight(), 
nodeId);
-                        executor.submit(triggerWork);
-                    }
-                }
             }
         });
     }
 
+    public boolean startNC(String nodeId) {
+        Pair<String, Integer> ncServiceAddress = getNCService(nodeId);
+        if (ncServiceAddress == null) {
+            return false;
+        }
+        final TriggerNCWork startNc = new 
TriggerNCWork(ClusterControllerService.this, ncServiceAddress.getLeft(),
+                ncServiceAddress.getRight(), nodeId);
+        executor.submit(startNc);
+        return true;
+
+    }
+
     private void terminateNCServices() throws Exception {
         List<ShutdownNCServiceWork> shutdownNCServiceWorks = new ArrayList<>();
         getNCServices().forEach((key, value) -> {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StartNodeApiServlet.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StartNodeApiServlet.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StartNodeApiServlet.java
new file mode 100644
index 0000000..4fd69ad
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StartNodeApiServlet.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.control.cc.web;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import io.netty.handler.codec.http.HttpResponseStatus;
+import org.apache.hyracks.control.cc.ClusterControllerService;
+import org.apache.hyracks.http.api.IServletRequest;
+import org.apache.hyracks.http.api.IServletResponse;
+import org.apache.hyracks.http.server.AbstractServlet;
+
+import java.io.PrintWriter;
+import java.util.Date;
+import java.util.concurrent.ConcurrentMap;
+
+public class StartNodeApiServlet extends AbstractServlet {
+    private ClusterControllerService ccs;
+
+    public StartNodeApiServlet(ConcurrentMap<String, Object> ctx, String[] 
paths, ClusterControllerService ccs) {
+        super(ctx, paths);
+        this.ccs = ccs;
+    }
+
+    @Override
+    protected void post(IServletRequest request, IServletResponse response) {
+        String nodeId = request.getParameter("node");
+        response.setStatus(HttpResponseStatus.OK);
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jsonObject = om.createObjectNode();
+        jsonObject.put("date", new Date().toString());
+        jsonObject.put("status", ccs.startNC(nodeId));
+        final PrintWriter writer = response.writer();
+        writer.print(jsonObject.toString());
+        writer.close();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/WebServer.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/WebServer.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/WebServer.java
index f79a178..f413fe5 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/WebServer.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/WebServer.java
@@ -49,6 +49,7 @@ public class WebServer {
         addJSONHandler("/rest/jobs/*", new JobsRESTAPIFunction(ccs));
         addJSONHandler("/rest/nodes/*", new NodesRESTAPIFunction(ccs));
         addJSONHandler("/rest/statedump", new StateDumpRESTAPIFunction(ccs));
+        server.addServlet(new StartNodeApiServlet(ctx, new String[] { 
"/rest/startnode" }, ccs));
         server.addServlet(new StaticResourceServlet(ctx, new String[] { 
"/static/*" }));
         server.addServlet(new ApplicationInstallationHandler(ctx, new String[] 
{ "/applications/*" }, ccs));
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
index 147e5e8..142afbf 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/ConfigManager.java
@@ -29,6 +29,7 @@ import java.util.Comparator;
 import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -307,7 +308,6 @@ public class ConfigManager implements IConfigManager, 
Serializable {
                     .parseSectionName(section.getParent() == null ? 
section.getName() : section.getParent().getName());
             String node;
             if (rootSection == Section.EXTENSION) {
-                parseExtensionIniSection(section);
                 continue;
             } else if (rootSection == Section.NC) {
                 node = section.getName().equals(section.getSimpleName()) ? 
null : section.getSimpleName();
@@ -332,10 +332,6 @@ public class ConfigManager implements IConfigManager, 
Serializable {
         }
     }
 
-    private void parseExtensionIniSection(Profile.Section section) {
-        // TODO(mblow): parse extensions
-    }
-
     private void handleUnknownOption(Profile.Section section, String name) 
throws HyracksException {
         Set<String> matches = new HashSet<>();
         for (IOption registeredOption : registeredOptions) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NCConfig.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NCConfig.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NCConfig.java
index e8c96d4..0a5ba30 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NCConfig.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/NCConfig.java
@@ -63,6 +63,10 @@ public class NCConfig extends ControllerConfig {
         MESSAGING_LISTEN_PORT(INTEGER, 0),
         MESSAGING_PUBLIC_ADDRESS(STRING, PUBLIC_ADDRESS),
         MESSAGING_PUBLIC_PORT(INTEGER, MESSAGING_LISTEN_PORT),
+        REPLICATION_PUBLIC_ADDRESS(STRING, PUBLIC_ADDRESS),
+        REPLICATION_PUBLIC_PORT(INTEGER, 2000),
+        REPLICATION_LISTEN_ADDRESS(STRING, ADDRESS),
+        REPLICATION_LISTEN_PORT(INTEGER, 2000),
         CLUSTER_CONNECT_RETRIES(INTEGER, 5),
         IODEVICES(
                 STRING_ARRAY,
@@ -115,6 +119,7 @@ public class NCConfig extends ControllerConfig {
         }
 
         @Override
+        @SuppressWarnings("squid:MethodCyclomaticComplexity")
         public String description() {
             switch (this) {
                 case ADDRESS:
@@ -128,8 +133,8 @@ public class NCConfig extends ControllerConfig {
                 case NCSERVICE_ADDRESS:
                     return "Address the CC should use to contact the NCService 
associated with this NC";
                 case NCSERVICE_PORT:
-                    return "Port the CC should use to contact the NCService 
associated with this NC (-1 to not use " +
-                            "NCService to start this NC)";
+                    return "Port the CC should use to contact the NCService 
associated with this NC (-1 to not use "
+                            + "NCService to start this NC)";
                 case CLUSTER_ADDRESS:
                     return "Cluster Controller address (required unless 
specified in config file)";
                 case CLUSTER_PORT:
@@ -167,6 +172,14 @@ public class NCConfig extends ControllerConfig {
                     return "Public IP Address to announce messaging listener";
                 case MESSAGING_PUBLIC_PORT:
                     return "Public IP port to announce messaging listener";
+                case REPLICATION_PUBLIC_ADDRESS:
+                    return "Public address to advertise for replication 
service";
+                case REPLICATION_PUBLIC_PORT:
+                    return "Public port to advertise for replication service";
+                case REPLICATION_LISTEN_ADDRESS:
+                    return "Replication bind address";
+                case REPLICATION_LISTEN_PORT:
+                    return "Port to listen on for replication service";
                 case CLUSTER_CONNECT_RETRIES:
                     return "Number of attempts to retry contacting CC before 
giving up";
                 case IODEVICES:
@@ -219,6 +232,10 @@ public class NCConfig extends ControllerConfig {
 
     }
 
+    public String getReplicationPublicAddress() {
+        return appConfig.getString(Option.REPLICATION_LISTEN_ADDRESS);
+    }
+
     public static final int NCSERVICE_PORT_DISABLED = -1;
 
     private List<String> appArgs = new ArrayList<>();
@@ -427,6 +444,10 @@ public class NCConfig extends ControllerConfig {
         configManager.set(nodeId, Option.MESSAGING_PUBLIC_PORT, 
messagingPublicPort);
     }
 
+    public int getReplicationPublicPort() {
+        return appConfig.getInt(Option.REPLICATION_LISTEN_PORT);
+    }
+
     public int getClusterConnectRetries() {
         return appConfig.getInt(Option.CLUSTER_CONNECT_RETRIES);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksCCProcess.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksCCProcess.java
 
b/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksCCProcess.java
index b2aa2d1..354dc32 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksCCProcess.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksCCProcess.java
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.hyracks.control.cc.CCDriver;
 
+@SuppressWarnings("squid:CommentedOutCodeLine")
 public class HyracksCCProcess extends HyracksServerProcess {
 
     public HyracksCCProcess(File configFile, File logFile, File appHome, File 
workingDir) {
@@ -41,6 +42,6 @@ public class HyracksCCProcess extends HyracksServerProcess {
     protected void addJvmArgs(List<String> cList) {
         // CC needs more than default memory
         cList.add("-Xmx1024m");
-        
//cList.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005");
+        
//cList.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
 //NOSONAR
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksServerProcess.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksServerProcess.java
 
b/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksServerProcess.java
index 7bb3332..c387ceb 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksServerProcess.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-server/src/main/java/org/apache/hyracks/server/process/HyracksServerProcess.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -65,7 +66,13 @@ abstract class HyracksServerProcess {
     public void stop() {
         process.destroy();
         try {
-            process.waitFor();
+            boolean success = process.waitFor(30, TimeUnit.SECONDS);
+            if (LOGGER.isLoggable(Level.WARNING)) {
+                LOGGER.warning("Killing unresponsive NC Process");
+            }
+            if (!success) {
+                process.destroyForcibly();
+            }
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
         }

Reply via email to