Skip to content

Commit 1fcb9dd

Browse files
authored
[FLINK-36051] Re-prepare invalid statement even if connection is valid (#138)
1 parent e36c3c1 commit 1fcb9dd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,10 @@ public synchronized void flush() throws IOException {
178178
throw new IOException(e);
179179
}
180180
try {
181-
if (!connectionProvider.isConnectionValid()) {
182-
updateExecutor(true);
183-
}
181+
updateExecutor(!connectionProvider.isConnectionValid());
184182
} catch (Exception exception) {
185-
LOG.error(
186-
"JDBC connection is not valid, and reestablish connection failed.",
187-
exception);
188-
throw new IOException("Reestablish JDBC connection failed", exception);
183+
LOG.error("Attempt to update the JDBC statement executor failed.", exception);
184+
throw new IOException("Unable to update JDBC statement executor", exception);
189185
}
190186
try {
191187
Thread.sleep(1000 * i);

0 commit comments

Comments
 (0)