Jiabao-Sun commented on code in PR #84:
URL: 
https://github.com/apache/flink-connector-mongodb/pull/84#discussion_r4624876920


##########
flink-connector-mongodb/src/main/java/org/apache/flink/connector/mongodb/sink/writer/MongoWriter.java:
##########
@@ -186,8 +186,13 @@ public synchronized void close() throws Exception {
                 try {
                     doBulkWrite();
                 } catch (Exception e) {
-                    LOG.error("Writing records to MongoDB failed when closing 
MongoWriter", e);
-                    throw new IOException("Writing records to MongoDB 
failed.", e);
+                    // Do not rethrow: delivery is guaranteed by flush(), so 
records still
+                    // buffered here are only written on a best-effort basis. 
They are left
+                    // over when the task failed or was cancelled, typically 
the very batch
+                    // whose flush just failed, and will be replayed from the 
last checkpoint.
+                    // Since FLINK-38180 (Flink 2.2) an exception thrown while 
cleaning up a
+                    // failed task is fatal and shuts down the whole 
TaskManager.
+                    LOG.warn("Writing records to MongoDB failed when closing 
writer", e);

Review Comment:
   https://github.com/apache/flink-connector-mongodb/pull/86 was open for this.



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