This is an automated email from the ASF dual-hosted git repository.

jiabaosun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-cdc.git


The following commit(s) were added to refs/heads/master by this push:
     new b937db25d [hotfix][cdc-connector][mongodb] Fix unstable test cases for 
snapshot back-filling (#3506)
b937db25d is described below

commit b937db25d5431d8cd5894b393ec7d4d7531c6fc2
Author: yuxiqian <[email protected]>
AuthorDate: Fri Aug 9 10:00:21 2024 +0800

    [hotfix][cdc-connector][mongodb] Fix unstable test cases for snapshot 
back-filling (#3506)
---
 .../connectors/mongodb/source/MongoDBParallelSourceITCase.java   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/test/java/org/apache/flink/cdc/connectors/mongodb/source/MongoDBParallelSourceITCase.java
 
b/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/test/java/org/apache/flink/cdc/connectors/mongodb/source/MongoDBParallelSourceITCase.java
index 25918fd8b..0595f6b5a 100644
--- 
a/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/test/java/org/apache/flink/cdc/connectors/mongodb/source/MongoDBParallelSourceITCase.java
+++ 
b/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mongodb-cdc/src/test/java/org/apache/flink/cdc/connectors/mongodb/source/MongoDBParallelSourceITCase.java
@@ -468,6 +468,15 @@ public class MongoDBParallelSourceITCase extends 
MongoDBSourceTestBase {
                     mongoCollection.updateOne(
                             Filters.eq("cid", 2000L), Updates.set("address", 
"Pittsburgh"));
                     mongoCollection.deleteOne(Filters.eq("cid", 1019L));
+
+                    // Rarely happens, but if there's no operation or 
heartbeat events between
+                    // watermark #a (the ChangeStream opLog caused by the last 
event in this hook)
+                    // and watermark #b (the calculated high watermark that 
limits the bounded
+                    // back-filling stream fetch task), the last event of hook 
will be missed since
+                    // back-filling task reads between [loW, hiW) (high 
watermark not included).
+                    // Workaround: insert a dummy event in another collection 
to forcefully push
+                    // opLog forward.
+                    database.getCollection("customers_1").insertOne(new 
Document());
                 };
 
         switch (hookType) {

Reply via email to