jw-itq commented on code in PR #8754: URL: https://github.com/apache/seatunnel/pull/8754#discussion_r1990694006
########## 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: > Cursor expire will lost data (or read duplicate) or not? If we can make sure this behavior would not lost any data then not provode any option is ok. If the current time is used, there is a possibility of data loss. Initially, the code did not include the logic of the current timestamp, and I don't understand why this logic was added at that time. <img width="1121" alt="image" src="https://github.com/user-attachments/assets/61629876-12fc-4206-a3c4-191bbd3460a2" /> the issue of writing a large amount of duplicate data during the restart of mongo cdc has been resolved in this submission. -- 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: commits-unsubscr...@seatunnel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org