>From Murtadha Hubail <[email protected]>: Murtadha Hubail has submitted this change. ( 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 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18363 Integration-Tests: Jenkins <[email protected]> Tested-by: Murtadha Hubail <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> Reviewed-by: Peeyush Gupta <[email protected]> --- M asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java 1 file changed, 47 insertions(+), 13 deletions(-) Approvals: Murtadha Hubail: Looks good to me, but someone else must approve; Verified Ali Alsuliman: Looks good to me, approved Peeyush Gupta: Looks good to me, approved Jenkins: Verified Objections: Anon. E. Moose #1000171: Violations found 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..e312b01 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; @@ -61,7 +62,6 @@ import org.apache.hyracks.ipc.impl.HyracksConnection; import org.apache.hyracks.storage.am.lsm.btree.impl.TestLsmBtreeLocalResource; import org.apache.hyracks.test.support.TestUtils; -import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -110,8 +110,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 +155,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 +186,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 +308,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 +378,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 +396,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: 3 Gerrit-Owner: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Peeyush Gupta <[email protected]> Gerrit-MessageType: merged
