DNM: refine dispatcher scan priority with syncpoint refine#4123
DNM: refine dispatcher scan priority with syncpoint refine#4123asddongmen wants to merge 36 commits intopingcap:masterfrom
Conversation
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
…tcher-scan-priority-v2
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
Signed-off-by: dongmen <414110582@qq.com>
…tcher-scan-priority-with-syncpoint-refine
Signed-off-by: dongmen <414110582@qq.com>
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. 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 |
Summary of ChangesHello @asddongmen, 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 introduces significant enhancements to event dispatching, memory management, and testing capabilities. It refines how syncpoints are handled by allowing them to be skipped under certain conditions, improving system responsiveness. A new dynamic scan interval adjustment mechanism intelligently adapts event processing rates based on memory pressure, optimizing resource utilization. The underlying congestion control protocol is upgraded to provide richer memory usage data. Additionally, the workload testing tool now supports comprehensive DDL operations, enabling more thorough testing of schema evolution scenarios. 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
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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a sophisticated mechanism to refine dispatcher scan priority and skip sync points, which is crucial for managing high changefeed lag. The implementation includes dynamic scan window adjustments based on memory pressure and adds a new Action_Skip. Additionally, a comprehensive DDL workload generator has been added to the testing tools. The core logic appears sound, with good test coverage and new metrics for better observability. My review includes a few suggestions to improve code clarity and reduce duplication.
| case heartbeatpb.Action_Pass, heartbeatpb.Action_Skip: | ||
| failpoint.Inject("BlockOrWaitBeforePass", nil) | ||
| d.PassBlockEventToSink(pendingEvent) | ||
| failpoint.Inject("BlockAfterPass", nil) | ||
| default: | ||
| failpoint.Inject("BlockOrWaitBeforePass", nil) | ||
| d.PassBlockEventToSink(pendingEvent) | ||
| failpoint.Inject("BlockAfterPass", nil) |
There was a problem hiding this comment.
The logic in the default case is identical to the case heartbeatpb.Action_Pass, heartbeatpb.Action_Skip. This code duplication can be removed by combining them. You can use a default case to handle Pass, Skip, and any potential future actions with the same logic, which simplifies the code and improves maintainability.
| case heartbeatpb.Action_Pass, heartbeatpb.Action_Skip: | |
| failpoint.Inject("BlockOrWaitBeforePass", nil) | |
| d.PassBlockEventToSink(pendingEvent) | |
| failpoint.Inject("BlockAfterPass", nil) | |
| default: | |
| failpoint.Inject("BlockOrWaitBeforePass", nil) | |
| d.PassBlockEventToSink(pendingEvent) | |
| failpoint.Inject("BlockAfterPass", nil) | |
| case heartbeatpb.Action_Pass, heartbeatpb.Action_Skip: | |
| fallthrough | |
| default: | |
| failpoint.Inject("BlockOrWaitBeforePass", nil) | |
| d.PassBlockEventToSink(pendingEvent) | |
| failpoint.Inject("BlockAfterPass", nil) |
| if existing, exists := changefeedUsedMemory[cfID]; exists { | ||
| changefeedUsedMemory[cfID] = min(existing, uint64(quota.MemoryUsage())) | ||
| } else { | ||
| changefeedUsedMemory[cfID] = uint64(quota.MemoryUsage()) | ||
| } | ||
| if existing, exists := changefeedMaxMemory[cfID]; exists { | ||
| changefeedMaxMemory[cfID] = min(existing, uint64(quota.MaxMemory())) | ||
| } else { | ||
| changefeedMaxMemory[cfID] = uint64(quota.MaxMemory()) | ||
| } |
There was a problem hiding this comment.
| } | ||
|
|
||
| func (w *Writer) SendSyncPointEvent(event *commonEvent.SyncPointEvent) error { | ||
| log.Info("fizz send syncpoint event", zap.Stringer("changefeedID", w.ChangefeedID), zap.Uint64("commitTs", event.GetCommitTs())) |
There was a problem hiding this comment.
The log message contains the word "fizz", which appears to be a temporary debug placeholder. It should be removed to make the log message clearer and more professional.
| log.Info("fizz send syncpoint event", zap.Stringer("changefeedID", w.ChangefeedID), zap.Uint64("commitTs", event.GetCommitTs())) | |
| log.Info("send syncpoint event", zap.Stringer("changefeedID", w.ChangefeedID), zap.Uint64("commitTs", event.GetCommitTs())) |
|
[FORMAT CHECKER NOTIFICATION] Notice: To remove the 📖 For more info, you can check the "Contribute Code" section in the development guide. |
What problem does this PR solve?
Issue Number: close #xxx
What is changed and how it works?
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