mateczagany commented on code in PR #279:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/279#discussion_r4785938417


##########
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:
   This can still throw in an edge case of MySQL with 
`SimpleXaConnectionProvider`, so to make sure I would also add a guard inside 
`SimpleXaConnectionProvider#close()` and move the `connection.close()` call to 
a try/catch block as well.



##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java:
##########
@@ -229,12 +232,7 @@ public synchronized void close() {
             }
 
             if (batchCount > 0) {
-                try {
-                    flush();
-                } catch (Exception e) {
-                    LOG.warn("Writing records to JDBC failed.", e);
-                    throw new RuntimeException("Writing records to JDBC 
failed.", e);
-                }
+                LOG.warn("Closing the JDBC writer with {} unflushed records.", 
batchCount);

Review Comment:
   This behavior change should also be reflected in the docs.



-- 
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]

Reply via email to