Skip to content

Commit

Permalink
[hotfix][cdc-connector][mongodb] Fix unstable test cases for snapshot…
Browse files Browse the repository at this point in the history
… back-filling (apache#3506)
  • Loading branch information
yuxiqian authored and qiaozongmi committed Sep 23, 2024
1 parent 54228b8 commit 096be8f
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,15 @@ private List<String> testBackfillWhenWritingEvents(
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) {
Expand Down

0 comments on commit 096be8f

Please sign in to comment.