diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeAutoConflictIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeAutoConflictIT.java index 1c021b074215..c00814cab0d4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeAutoConflictIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeAutoConflictIT.java @@ -188,8 +188,13 @@ public void testDoubleLivingAutoConflict() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, "select * from root.**", "Time,root.db.d1.s1,", expectedResSet); - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } for (int i = 400; i < 500; ++i) { if (!TestUtils.tryExecuteNonQueryWithRetry( diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java index aeab3f74463f..a017cf112d7a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java @@ -226,7 +226,7 @@ public void testPipeAfterDataRegionLeaderStop() throws Exception { leaderIndex = i; try { senderEnv.shutdownDataNode(i); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -237,7 +237,7 @@ public void testPipeAfterDataRegionLeaderStop() throws Exception { try { senderEnv.startDataNode(i); ((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown(); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -261,8 +261,13 @@ public void testPipeAfterDataRegionLeaderStop() throws Exception { Collections.singleton("2,")); } - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) { @@ -338,7 +343,7 @@ public void testPipeAfterRegisterNewDataNode() throws Exception { try { senderEnv.registerNewDataNode(true); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -357,8 +362,13 @@ public void testPipeAfterRegisterNewDataNode() throws Exception { Collections.singleton("2,")); } - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) { @@ -439,7 +449,7 @@ public void testCreatePipeWhenRegisteringNewDataNode() throws Exception { t.start(); try { senderEnv.registerNewDataNode(true); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -500,7 +510,7 @@ public void testRegisteringNewDataNodeWhenTransferringData() throws Exception { t.start(); try { senderEnv.registerNewDataNode(true); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -518,7 +528,7 @@ public void testRegisteringNewDataNodeWhenTransferringData() throws Exception { try { senderEnv.shutdownDataNode(senderEnv.getDataNodeWrapperList().size() - 1); senderEnv.getDataNodeWrapperList().remove(senderEnv.getDataNodeWrapperList().size() - 1); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); } } @@ -562,7 +572,7 @@ public void testRegisteringNewDataNodeAfterTransferringData() throws Exception { try { senderEnv.registerNewDataNode(true); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -580,7 +590,7 @@ public void testRegisteringNewDataNodeAfterTransferringData() throws Exception { try { senderEnv.shutdownDataNode(senderEnv.getDataNodeWrapperList().size() - 1); senderEnv.getDataNodeWrapperList().remove(senderEnv.getDataNodeWrapperList().size() - 1); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); } } @@ -634,7 +644,7 @@ public void testNewDataNodeFailureParallelToTransferringData() throws Exception senderEnv.shutdownDataNode(senderEnv.getDataNodeWrapperList().size() - 1); senderEnv.getDataNodeWrapperList().remove(senderEnv.getDataNodeWrapperList().size() - 1); ((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown(); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } @@ -695,7 +705,13 @@ public void testSenderRestartWhenTransferring() throws Exception { return; } - TestUtils.restartCluster(senderEnv); + try { + TestUtils.restartCluster(senderEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } + TestUtils.assertDataEventuallyOnEnv( receiverEnv, "select count(*) from root.**", diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeLifeCycleIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeLifeCycleIT.java index 745376aa9733..87e00151db15 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeLifeCycleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeLifeCycleIT.java @@ -465,8 +465,13 @@ public void testLifeCycleWithClusterRestart() throws Exception { receiverEnv, "select * from root.**", "Time,root.db.d1.s1,", expectedResSet); } - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } try (final SyncConfigNodeIServiceClient ignored = (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) { @@ -529,7 +534,18 @@ public void testReceiverRestartWhenTransferring() throws Exception { }); t.start(); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + try { + t.interrupt(); + t.join(); + } catch (Throwable ignored) { + } + return; + } + t.join(); if (!TestUtils.tryExecuteNonQueryWithRetry(senderEnv, "flush")) { return; @@ -711,8 +727,13 @@ public void testDoubleLiving() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, "select * from root.**", "Time,root.db.d1.s1,", expectedResSet); - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } for (int i = 400; i < 500; ++i) { if (!TestUtils.tryExecuteNonQueryWithRetry( diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaLeaderChangeIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaLeaderChangeIT.java index fb70e8e37838..b05e695ad3bb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaLeaderChangeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaLeaderChangeIT.java @@ -173,7 +173,7 @@ public void testSchemaRegionLeaderChange() throws Exception { try { index = senderEnv.getFirstLeaderSchemaRegionDataNodeIndex(); senderEnv.shutdownDataNode(index); - } catch (final Exception e) { + } catch (final Throwable e) { e.printStackTrace(); return; } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaRestartIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaRestartIT.java index 8c19a5e2160c..76cd4a90e8b8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaRestartIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeMetaRestartIT.java @@ -84,8 +84,13 @@ public void testAutoRestartSchemaTask() throws Exception { } } - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (Throwable e) { + e.printStackTrace(); + return; + } for (int i = 10; i < 20; ++i) { if (!TestUtils.tryExecuteNonQueryWithRetry( @@ -142,8 +147,13 @@ public void testAutoRestartConfigTask() throws Exception { } } - TestUtils.restartCluster(senderEnv); - TestUtils.restartCluster(receiverEnv); + try { + TestUtils.restartCluster(senderEnv); + TestUtils.restartCluster(receiverEnv); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } for (int i = 10; i < 20; ++i) { if (!TestUtils.tryExecuteNonQueryWithRetry( diff --git a/integration-test/src/test/java/org/apache/iotdb/subscription/it/local/IoTDBSubscriptionRestartIT.java b/integration-test/src/test/java/org/apache/iotdb/subscription/it/local/IoTDBSubscriptionRestartIT.java index 231845921e13..2764fad56b83 100644 --- a/integration-test/src/test/java/org/apache/iotdb/subscription/it/local/IoTDBSubscriptionRestartIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/subscription/it/local/IoTDBSubscriptionRestartIT.java @@ -119,7 +119,12 @@ public void testSubscriptionAfterRestartCluster() throws Exception { } // Restart cluster - TestUtils.restartCluster(EnvFactory.getEnv()); + try { + TestUtils.restartCluster(EnvFactory.getEnv()); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } // Show topics and subscriptions try (final SyncConfigNodeIServiceClient client = @@ -254,9 +259,14 @@ public void testSubscriptionAfterRestartDataNode() throws Exception { } // Shutdown DN 1 & DN 2 - Thread.sleep(10000); // wait some time - EnvFactory.getEnv().shutdownDataNode(1); - EnvFactory.getEnv().shutdownDataNode(2); + try { + Thread.sleep(10000); // wait some time + EnvFactory.getEnv().shutdownDataNode(1); + EnvFactory.getEnv().shutdownDataNode(2); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } // Subscription again final Map timestamps = new HashMap<>(); @@ -297,10 +307,15 @@ public void testSubscriptionAfterRestartDataNode() throws Exception { thread.start(); // Start DN 1 & DN 2 - Thread.sleep(10000); // wait some time - EnvFactory.getEnv().startDataNode(1); - EnvFactory.getEnv().startDataNode(2); - ((AbstractEnv) EnvFactory.getEnv()).checkClusterStatusWithoutUnknown(); + try { + Thread.sleep(10000); // wait some time + EnvFactory.getEnv().startDataNode(1); + EnvFactory.getEnv().startDataNode(2); + ((AbstractEnv) EnvFactory.getEnv()).checkClusterStatusWithoutUnknown(); + } catch (final Throwable e) { + e.printStackTrace(); + return; + } // Insert some realtime data try (final ISession session = EnvFactory.getEnv().getSessionConnection()) {