This is an automated email from the ASF dual-hosted git repository.
qiaojialin 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 25f7f55 [IOTDB-1506] CI fails because of JDBC connection exceptions
(#3577)
25f7f55 is described below
commit 25f7f5587bd583300f761329d94f3c6c8af32ddf
Author: Steve Yurong Su (宇荣) <[email protected]>
AuthorDate: Thu Jul 15 06:28:56 2021 -0500
[IOTDB-1506] CI fails because of JDBC connection exceptions (#3577)
---
.../db/integration/IoTDBContinuousQueryIT.java | 43 +++++++++++++++-------
.../db/integration/IoTDBTriggerExecutionIT.java | 43 +++++++++++++++++-----
2 files changed, 64 insertions(+), 22 deletions(-)
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
index c72c04e..b374ed2 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
@@ -30,7 +30,11 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -57,21 +61,34 @@ public class IoTDBContinuousQueryIT {
@Override
public void run() {
- try (Connection connection =
- DriverManager.getConnection(
- Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
"root");
- Statement statement = connection.createStatement()) {
+ try {
+ Connection connection =
+ DriverManager.getConnection(
+ Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
"root");
+ Statement statement = connection.createStatement();
do {
-
for (String timeSeries : timeSeriesArray) {
- try {
- statement.execute(
- String.format(
- "insert into %s(timestamp, temperature)
values(now(), %.3f)",
- timeSeries, 200 * Math.random()));
- } catch (SQLException throwables) {
- LOGGER.error(throwables.getMessage());
+ boolean isSuccessful = false;
+ while (!isSuccessful) {
+ try {
+ statement.execute(
+ String.format(
+ "insert into %s(timestamp, temperature)
values(now(), %.3f)",
+ timeSeries, 200 * Math.random()));
+ isSuccessful = true;
+ } catch (SQLException throwable) {
+ LOGGER.error(throwable.getMessage());
+ throwable.printStackTrace();
+
+ statement.close();
+ connection.close();
+
+ connection =
+ DriverManager.getConnection(
+ Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/",
"root", "root");
+ statement = connection.createStatement();
+ }
}
}
} while (!isInterrupted());
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBTriggerExecutionIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBTriggerExecutionIT.java
index 2b55143..ef5ab2f 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBTriggerExecutionIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBTriggerExecutionIT.java
@@ -61,19 +61,44 @@ public class IoTDBTriggerExecutionIT {
@Override
public void run() {
- try (Connection connection =
- DriverManager.getConnection(
- Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
"root");
- Statement statement = connection.createStatement()) {
+ try {
+ Connection connection =
+ DriverManager.getConnection(
+ Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
"root");
+ Statement statement = connection.createStatement();
+
long count = 0;
do {
++count;
- statement.execute(
- String.format(
- "insert into
root.vehicle.d1(timestamp,s1,s2,s3,s4,s5,s6) values(%d,%d,%d,%d,%d,%s,\"%d\")",
- count, count, count, count, count, count % 2 == 0 ?
"true" : "false", count));
+ boolean isSuccessful = false;
+ while (!isSuccessful) {
+ try {
+ statement.execute(
+ String.format(
+ "insert into
root.vehicle.d1(timestamp,s1,s2,s3,s4,s5,s6) values(%d,%d,%d,%d,%d,%s,\"%d\")",
+ count,
+ count,
+ count,
+ count,
+ count,
+ count % 2 == 0 ? "true" : "false",
+ count));
+ isSuccessful = true;
+ } catch (SQLException throwable) {
+ LOGGER.error(throwable.getMessage());
+ throwable.printStackTrace();
+
+ statement.close();
+ connection.close();
+
+ connection =
+ DriverManager.getConnection(
+ Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
"root");
+ statement = connection.createStatement();
+ }
+ }
} while (!isInterrupted());
- } catch (SQLException e) {
+ } catch (Exception e) {
exception = e;
}
}