logpuller: fix filterLoop flag propagation for stop tasks#4259
logpuller: fix filterLoop flag propagation for stop tasks#4259ti-chi-bot[bot] merged 1 commit intomasterfrom
Conversation
Summary of ChangesHello @lidezhu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue related to filtering data loops in TiCDC, particularly in Bi-Directional Replication (BDR) scenarios. It introduces a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request correctly introduces a filterLoop flag to support Bidirectional Replication (BDR) mode, ensuring that events originating from TiCDC are not replicated back. The changes involve adding the filterLoop field to the subscribedSpan struct and propagating it to various tasks, which is a solid approach. A crucial bug fix in setTableStopped is included and well-covered by a new test.
My main suggestion is to refactor the rangeTask struct to remove a redundant filterLoop field, as this information is already available in the associated subscribedSpan. This will improve code clarity and maintainability. Overall, the changes are in the right direction.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: asddongmen, hongyunyan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: close #4261
What is changed and how it works?
This pull request addresses an issue related to filtering data loops in TiCDC, particularly in Bi-Directional Replication (BDR) scenarios. It introduces a
filterLoopflag within the subscription mechanism to correctly identify and filter out data written by TiCDC itself, preventing infinite replication loops. The changes ensure that this critical filtering state is properly initialized and propagated across various internal components, enhancing the robustness of the replication process.Highlights
filterLoopfield tosubscribedSpan: A new boolean fieldfilterLoopwas added to thesubscribedSpanstruct. This field indicates whether to filter out values written by TiCDC itself, primarily for BDR (Bi-Directional Replication) mode.filterLoopinnewSubscribedSpan: ThenewSubscribedSpanfunction was updated to accept afilterLoopparameter, ensuring that this value is correctly initialized when a newsubscribedSpanis created.filterLoopconsistency in tasks: ThefilterLoopvalue is now consistently passed throughrangeTaskandregionInfostructures, ensuring that the filtering logic is applied throughout the subscription lifecycle, especially when stopping tables.filterLoopparameter innewSubscribedSpancalls, and a new test caseTestStopTaskUsesSubscribedSpanFilterLoopwas added to verify correct propagation of thefilterLoopvalue when a table is stopped.Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note
Summary by CodeRabbit
Improvements
Tests