-
Notifications
You must be signed in to change notification settings - Fork 298
dm: make binlog event cache configurable #12411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
[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 |
Summary of ChangesHello @OliverS929, 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 enhances the TiFlow DM component by providing a new configuration option, Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a configurable event-cache-count for the Syncer and Validator, which is a great addition for managing memory usage. The implementation is consistent across the configuration files and the new test case is a good addition.
I have a couple of suggestions to centralize the default value handling to avoid redundancy.
Also, the PR description states that the 'Default value for both behave the same as before', but it seems the default behavior is changed from no caching (EventCacheCount=0) to caching 10240 events. This might be an intended change, but the description should be updated to reflect this to avoid confusion for users upgrading.
| WorkerCount: defaultWorkerCount, | ||
| Batch: defaultBatch, | ||
| QueueSize: defaultQueueSize, | ||
| EventCacheCount: defaultEventCacheCount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Mode: ValidationNone, | ||
| EventCacheCount: defaultEventCacheCount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To centralize default value handling, consider setting the default for EventCacheCount only within ValidatorConfig.Adjust, and removing it from here. This avoids redundancy and makes it clearer where defaults are applied.
| Mode: ValidationNone, | |
| EventCacheCount: defaultEventCacheCount, | |
| Mode: ValidationNone, |
| if inst.Syncer.EventCacheCount == 0 { | ||
| inst.Syncer.EventCacheCount = defaultEventCacheCount | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check appears to be redundant. SyncerConfig instances are initialized with default values from DefaultSyncerConfig through UnmarshalYAML. Consequently, this check will likely always evaluate to false. It would be cleaner to rely on DefaultSyncerConfig as the single source for defaults and remove this check.
|
@OliverS929: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
| } | ||
|
|
||
| v.syncCfg, err = subtaskCfg2BinlogSyncerCfg(v.cfg, v.timezone, v.syncer.baList) | ||
| v.syncCfg, err = subtaskCfg2BinlogSyncerCfg(v.cfg, v.timezone, v.syncer.baList, v.cfg.ValidatorCfg.EventCacheCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use the same config as syncer, validator shares many config as syncer
What problem does this PR solve?
Issue Number: ref #12410
What is changed and how it works?
Introduces a new configuration option, event-cache-count, for both the Syncer and Validator components. It allows users to control the number of events cached during binlog sync and decoding.
By lowering event-cache-count, users can reduce memory usage in scenarios where binlog processing consumes a significant amount of memory, helping prevent potential OOM issues on the worker.
Default value for both behave the same as before.
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