MartijnVisser commented on code in PR #279:
URL:
https://github.com/apache/flink-connector-jdbc/pull/279#discussion_r4792069888
##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java:
##########
@@ -188,53 +188,66 @@ public synchronized void flush() throws IOException {
for (int i = 0; i <= executionOptions.getMaxRetries(); i++) {
try {
+ if (i > 0) {
+ updateExecutor(!connectionProvider.isConnectionValid());
+ }
attemptFlush();
batchCount = 0;
break;
+ } catch (ClassNotFoundException e) {
+ throw new IOException("Unable to update JDBC statement
executor", e);
} catch (SQLException e) {
LOG.error("JDBC executeBatch error, retry times = {}", i, e);
if (i >= executionOptions.getMaxRetries()) {
throw new IOException(e);
}
try {
- updateExecutor(!connectionProvider.isConnectionValid());
- } catch (Exception exception) {
- LOG.error("Attempt to update the JDBC statement executor
failed.", exception);
- throw new IOException("Unable to update JDBC statement
executor", exception);
- }
- try {
- Thread.sleep(1000 * i);
+ waitBeforeRetry(1000L * i);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IOException(
"unable to flush; interrupted while doing another
attempt", e);
}
+ if (closed) {
Review Comment:
None of the output format tests fail with this check removed. Can you assert
in `testCloseDoesNotWaitForTheBackgroundFlushBackoff` that `reconnectAttempts`
doesn't change after `close()`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]