You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2024/04/29 09:55:27 UTC
(iotdb) branch master updated: Allowing create statement from bad connection (#12444)
This is an automated email from the ASF dual-hosted git repository.
tanxinyu 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 c2837425ad6 Allowing create statement from bad connection (#12444)
c2837425ad6 is described below
commit c2837425ad6185a2f8eec07483773e7c0c4eaa11
Author: Li Yu Heng <li...@126.com>
AuthorDate: Mon Apr 29 17:55:21 2024 +0800
Allowing create statement from bad connection (#12444)
* seems not necessary
* Revert "seems not necessary"
This reverts commit 1f786173f183ca3f0f5bb75856deedd7a9032450.
* I hope so
---
.../iotdb/itbase/runtime/ClusterTestStatement.java | 38 +++++++++++++++-------
1 file changed, 27 insertions(+), 11 deletions(-)
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 552244bd5a5..c6b139a3eeb 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
@@ -20,6 +20,9 @@ package org.apache.iotdb.itbase.runtime;
import org.apache.iotdb.jdbc.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -31,9 +34,10 @@ import java.util.List;
/** The implementation of {@link ClusterTestStatement} in cluster test. */
public class ClusterTestStatement implements Statement {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterTestStatement.class);
private static final int DEFAULT_QUERY_TIMEOUT = 120;
- private final Statement writeStatement;
- private final String writEndpoint;
+ private Statement writeStatement;
+ private String writEndpoint;
private final List<Statement> readStatements = new ArrayList<>();
private final List<String> readEndpoints = new ArrayList<>();
private boolean closed = false;
@@ -41,16 +45,28 @@ public class ClusterTestStatement implements Statement {
private int queryTimeout = DEFAULT_QUERY_TIMEOUT;
private int fetchSize = Config.DEFAULT_FETCH_SIZE;
- public ClusterTestStatement(NodeConnection writeConnection, List<NodeConnection> readConnections)
- throws SQLException {
- this.writeStatement = writeConnection.getUnderlyingConnecton().createStatement();
- updateConfig(writeStatement, 0);
- writEndpoint = writeConnection.toString();
+ public ClusterTestStatement(
+ NodeConnection writeConnection, List<NodeConnection> readConnections) {
+ try {
+ this.writeStatement = writeConnection.getUnderlyingConnecton().createStatement();
+ updateConfig(writeStatement, 0);
+ writEndpoint = writeConnection.toString();
+ } catch (SQLException e) {
+ LOGGER.warn("Failed to create write statement.", e);
+ }
+
for (NodeConnection readConnection : readConnections) {
- Statement readStatement = readConnection.getUnderlyingConnecton().createStatement();
- this.readStatements.add(readStatement);
- this.readEndpoints.add(readConnection.toString());
- updateConfig(readStatement, queryTimeout);
+ try {
+ Statement readStatement = readConnection.getUnderlyingConnecton().createStatement();
+ this.readStatements.add(readStatement);
+ this.readEndpoints.add(readConnection.toString());
+ updateConfig(readStatement, queryTimeout);
+ } catch (SQLException e) {
+ LOGGER.warn("Cannot create read statement from connection {}.", readConnection, e);
+ }
+ }
+ if (readStatements.isEmpty()) {
+ LOGGER.warn("Failed to create any read statement.");
}
}