jw-itq commented on code in PR #8754:
URL: https://github.com/apache/seatunnel/pull/8754#discussion_r1990651021


##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/fetch/MongodbStreamFetchTask.java:
##########
@@ -117,7 +120,23 @@ public void execute(Context context) {
         this.taskRunning = true;
         try {
             while (taskRunning) {
-                Optional<BsonDocument> next = 
Optional.ofNullable(changeStreamCursor.tryNext());
+                Optional<BsonDocument> next;
+                try {
+                    next = Optional.ofNullable(changeStreamCursor.tryNext());
+                } catch (MongoCommandException e) {
+                    if (MongodbUtils.checkIfChangeStreamCursorExpires(e)) {

Review Comment:
   > Can we add an option to let user decide to fallback to timestamp restart 
mode or direct throw exception?
   
   ok, thank you!, but the failure of the resume token captures the 280 
exception in mongo. At this time, the resume token is invalid, but the 
timestamp is generally valid, which means that the oplog log may still be 
there. When the timestamp cannot be found, it means that the oplog log is also 
missing. At this time, it means that breakpoint recovery is completely 
impossible, and there is a normal exception occurring,this is to ensure smooth 
recovery from breakpoints. I am wondering if it is necessary to add 
configuration options for users to choose from.



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