>From Murtadha Hubail <[email protected]>:
Murtadha Hubail has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18363 )
Change subject: [NO ISSUE][TEST] Catch all failures on cc/nc startup
......................................................................
[NO ISSUE][TEST] Catch all failures on cc/nc startup
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Catch all nc/cc startup failures in AsterixHyracksIntegrationUtil.
Change-Id: Ifcbe1a0dff7f3dbb7e6b258d43bcbd5a2deb7020
---
M
asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
1 file changed, 41 insertions(+), 12 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/63/18363/1
diff --git
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 506e82a..bfe180f 100644
---
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiPredicate;
import java.util.stream.Stream;
@@ -110,8 +111,8 @@
try {
integrationUtil.run(Boolean.getBoolean("cleanup.start"),
Boolean.getBoolean("cleanup.shutdown"),
getConfPath());
- } catch (Exception e) {
- LOGGER.fatal("Unexpected exception", e);
+ } catch (Throwable t) {
+ LOGGER.fatal("Unexpected exception", t);
System.exit(1);
}
}
@@ -155,19 +156,27 @@
}
opts.forEach(opt -> configManager.set(opt.getLeft(), opt.getRight()));
- cc.start();
+ try {
+ cc.start();
+ } catch (Throwable t) {
+ LOGGER.error("failed to start cc", t);
+ throw t;
+ }
// Starts ncs.
nodeNames = ccConfig.getConfigManager().getNodeNames();
List<Thread> startupThreads = new ArrayList<>();
+ AtomicBoolean ncFailedToStart = new AtomicBoolean(false);
for (NodeControllerService nc : nodeControllers) {
Thread ncStartThread = new Thread("IntegrationUtil-" + nc.getId())
{
@Override
public void run() {
try {
nc.start();
- } catch (Exception e) {
- LOGGER.log(Level.ERROR, e.getMessage(), e);
+ LOGGER.info("started node {}", nc.getId());
+ } catch (Throwable t) {
+ LOGGER.error("failed to start node {}", nc.getId(), t);
+ ncFailedToStart.set(true);
}
}
};
@@ -178,11 +187,14 @@
for (Thread thread : startupThreads) {
thread.join();
}
+ if (ncFailedToStart.get()) {
+ throw new Exception("some node failed to start");
+ }
// Wait until cluster becomes active
((ICcApplicationContext)
cc.getApplicationContext()).getClusterStateManager().waitForState(ClusterState.ACTIVE);
hcc = new HyracksConnection(cc.getConfig().getClientListenAddress(),
cc.getConfig().getClientListenPort(),
cc.getNetworkSecurityManager().getSocketChannelFactory());
- this.ncs = nodeControllers.toArray(new
NodeControllerService[nodeControllers.size()]);
+ this.ncs = nodeControllers.toArray(new NodeControllerService[0]);
}
@NotNull
@@ -297,8 +309,8 @@
public void run() {
try {
nodeControllerService.stop();
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (Throwable t) {
+ LOGGER.error("failed to stop node {}",
nodeControllerService.getId(), t);
}
}
};
@@ -367,8 +379,8 @@
public void run() {
try {
deinit(cleanupOnShutdown);
- } catch (Exception e) {
- LOGGER.log(Level.WARN, "Unexpected exception on shutdown",
e);
+ } catch (Throwable t) {
+ LOGGER.warn("Unexpected exception on shutdown", t);
}
}
});
@@ -385,8 +397,8 @@
public void run() {
try {
deinit(cleanupOnShutdown);
- } catch (Exception e) {
- LOGGER.log(Level.WARN, "Unexpected exception on shutdown",
e);
+ } catch (Throwable t) {
+ LOGGER.warn("Unexpected exception on shutdown", t);
}
}
});
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18363
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Ifcbe1a0dff7f3dbb7e6b258d43bcbd5a2deb7020
Gerrit-Change-Number: 18363
Gerrit-PatchSet: 1
Gerrit-Owner: Murtadha Hubail <[email protected]>
Gerrit-MessageType: newchange