yuxiqian commented on code in PR #3221:
URL: https://github.com/apache/flink-cdc/pull/3221#discussion_r1560819276


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/main/java/org/apache/flink/cdc/connectors/mongodb/source/reader/fetch/MongoDBStreamFetchTask.java:
##########
@@ -108,7 +110,32 @@ public void execute(Context context) throws Exception {
         this.taskRunning = true;
         try {
             while (taskRunning) {
-                Optional<BsonDocument> next = 
Optional.ofNullable(changeStreamCursor.tryNext());
+                Optional<BsonDocument> next;
+                try {
+                    next = Optional.ofNullable(changeStreamCursor.tryNext());
+                } catch (MongoQueryException e) {
+                    if (e.getErrorCode() == CHANGE_STREAM_FATAL_ERROR) {
+                        ChangeStreamOffset offset =
+                                new 
ChangeStreamOffset(streamSplit.getStartingOffset().getOffset());

Review Comment:
   @Jiabao-Sun You're right, I've added resume token expiration checks in 
creating and iterating process.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to