velo commented on code in PR #279:
URL:
https://github.com/apache/flink-connector-jdbc/pull/279#discussion_r4787695269
##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java:
##########
@@ -188,20 +188,19 @@ 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);
Review Comment:
Done in c8b4155, waits instead of sleeping.
##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/writer/JdbcWriter.java:
##########
@@ -218,7 +218,6 @@ public void close() throws Exception {
} else {
// don't jdbcOutput.close(); as we don't want neither to flush nor
to close connection
// here
- this.jdbcOutput.checkFlushException();
Review Comment:
Added in caf9fde.
##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/writer/JdbcWriter.java:
##########
@@ -218,7 +218,6 @@ public void close() throws Exception {
} else {
// don't jdbcOutput.close(); as we don't want neither to flush nor
to close connection
// here
- this.jdbcOutput.checkFlushException();
this.jdbcTransaction.close();
Review Comment:
Thanks, agreed.
--
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]