This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 82f203e4039 Pipe IT: Ignore failed cases caused by cluster restart 
failure (#12678)
82f203e4039 is described below

commit 82f203e40390ed04936fb50dda0e84f4219de42a
Author: Steve Yurong Su <[email protected]>
AuthorDate: Thu Jun 6 17:58:16 2024 +0800

    Pipe IT: Ignore failed cases caused by cluster restart failure (#12678)
---
 .../it/autocreate/IoTDBPipeAutoConflictIT.java     |  9 ++++-
 .../pipe/it/autocreate/IoTDBPipeClusterIT.java     | 44 +++++++++++++++-------
 .../pipe/it/autocreate/IoTDBPipeLifeCycleIT.java   | 31 ++++++++++++---
 .../it/manual/IoTDBPipeMetaLeaderChangeIT.java     |  2 +-
 .../pipe/it/manual/IoTDBPipeMetaRestartIT.java     | 18 +++++++--
 .../it/local/IoTDBSubscriptionRestartIT.java       | 31 +++++++++++----
 6 files changed, 101 insertions(+), 34 deletions(-)

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 1c021b07421..c00814cab0d 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 class IoTDBPipeAutoConflictIT extends 
AbstractPipeDualAutoIT {
     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 aeab3f74463..a017cf112d7 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 class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
           leaderIndex = i;
           try {
             senderEnv.shutdownDataNode(i);
-          } catch (final Exception e) {
+          } catch (final Throwable e) {
             e.printStackTrace();
             return;
           }
@@ -237,7 +237,7 @@ public class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
           try {
             senderEnv.startDataNode(i);
             ((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown();
-          } catch (final Exception e) {
+          } catch (final Throwable e) {
             e.printStackTrace();
             return;
           }
@@ -261,8 +261,13 @@ public class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
           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 class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
 
       try {
         senderEnv.registerNewDataNode(true);
-      } catch (final Exception e) {
+      } catch (final Throwable e) {
         e.printStackTrace();
         return;
       }
@@ -357,8 +362,13 @@ public class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
           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 class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
       t.start();
       try {
         senderEnv.registerNewDataNode(true);
-      } catch (final Exception e) {
+      } catch (final Throwable e) {
         e.printStackTrace();
         return;
       }
@@ -500,7 +510,7 @@ public class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
       t.start();
       try {
         senderEnv.registerNewDataNode(true);
-      } catch (final Exception e) {
+      } catch (final Throwable e) {
         e.printStackTrace();
         return;
       }
@@ -518,7 +528,7 @@ public class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
       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 class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
 
       try {
         senderEnv.registerNewDataNode(true);
-      } catch (final Exception e) {
+      } catch (final Throwable e) {
         e.printStackTrace();
         return;
       }
@@ -580,7 +590,7 @@ public class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
       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 class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
         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 class IoTDBPipeClusterIT extends 
AbstractPipeDualAutoIT {
       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 745376aa973..87e00151db1 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 class IoTDBPipeLifeCycleIT extends 
AbstractPipeDualAutoIT {
           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 class IoTDBPipeLifeCycleIT extends 
AbstractPipeDualAutoIT {
               });
       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 class IoTDBPipeLifeCycleIT extends 
AbstractPipeDualAutoIT {
     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 fb70e8e3783..b05e695ad3b 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 class IoTDBPipeMetaLeaderChangeIT extends 
AbstractPipeDualManualIT {
     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 8c19a5e2160..76cd4a90e8b 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 class IoTDBPipeMetaRestartIT extends 
AbstractPipeDualManualIT {
       }
     }
 
-    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 class IoTDBPipeMetaRestartIT extends 
AbstractPipeDualManualIT {
       }
     }
 
-    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 231845921e1..2764fad56b8 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 class IoTDBSubscriptionRestartIT {
     }
 
     // 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 class IoTDBSubscriptionRestartIT {
     }
 
     // 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<Long, Long> timestamps = new HashMap<>();
@@ -297,10 +307,15 @@ public class IoTDBSubscriptionRestartIT {
     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()) {

Reply via email to