You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2023/11/23 01:44:39 UTC

(iotdb) branch master updated: Fix flasky ITs (#11574)

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

haonan 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 7f425fc586d Fix flasky ITs (#11574)
7f425fc586d is described below

commit 7f425fc586d3786b4e75e7d0e304da02ef3bd1e8
Author: Haonan <hh...@outlook.com>
AuthorDate: Thu Nov 23 09:44:33 2023 +0800

    Fix flasky ITs (#11574)
---
 .../java/org/apache/iotdb/it/env/cluster/ClusterConstant.java  |  2 +-
 .../org/apache/iotdb/itbase/runtime/ClusterTestStatement.java  | 10 +++++-----
 .../src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java    |  6 +++++-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
index 1ce6143887c..6cf9fb71c1c 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
@@ -198,7 +198,7 @@ public class ClusterConstant {
   // Env Constant
   public static final int NODE_START_TIMEOUT = 100;
   public static final int PROBE_TIMEOUT_MS = 2000;
-  public static final int NODE_NETWORK_TIMEOUT_MS = 65_000;
+  public static final int NODE_NETWORK_TIMEOUT_MS = 0;
 
   public static final String DELIMITER = ",";
   public static final String TAB = "  ";
diff --git a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
index 032015f15ad..552244bd5a5 100644
--- a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
+++ b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
@@ -31,7 +31,7 @@ import java.util.List;
 /** The implementation of {@link ClusterTestStatement} in cluster test. */
 public class ClusterTestStatement implements Statement {
 
-  private static final int DEFAULT_QUERY_TIMEOUT = 60;
+  private static final int DEFAULT_QUERY_TIMEOUT = 120;
   private final Statement writeStatement;
   private final String writEndpoint;
   private final List<Statement> readStatements = new ArrayList<>();
@@ -44,19 +44,19 @@ public class ClusterTestStatement implements Statement {
   public ClusterTestStatement(NodeConnection writeConnection, List<NodeConnection> readConnections)
       throws SQLException {
     this.writeStatement = writeConnection.getUnderlyingConnecton().createStatement();
-    updateConfig(writeStatement);
+    updateConfig(writeStatement, 0);
     writEndpoint = writeConnection.toString();
     for (NodeConnection readConnection : readConnections) {
       Statement readStatement = readConnection.getUnderlyingConnecton().createStatement();
       this.readStatements.add(readStatement);
       this.readEndpoints.add(readConnection.toString());
-      updateConfig(readStatement);
+      updateConfig(readStatement, queryTimeout);
     }
   }
 
-  private void updateConfig(Statement statement) throws SQLException {
+  private void updateConfig(Statement statement, int timeout) throws SQLException {
     maxRows = Math.min(statement.getMaxRows(), maxRows);
-    statement.setQueryTimeout(queryTimeout);
+    statement.setQueryTimeout(timeout);
   }
 
   @Override
diff --git a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
index f084b921d3d..31bd7a92624 100644
--- a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
+++ b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
@@ -219,7 +219,11 @@ public class IoTDBStatement implements Statement {
       return executeSQL(sql);
     } catch (TException e) {
       if (reConnect()) {
-        throw new SQLException(String.format("Fail to execute %s", sql), e);
+        try {
+          return executeSQL(sql);
+        } catch (TException e2) {
+          throw new SQLException(String.format("Fail to execute %s", sql), e2);
+        }
       } else {
         throw new SQLException(
             String.format(