-
Notifications
You must be signed in to change notification settings - Fork 26
Cherry pick https://github.com/pingcap/ticdc/pull/1922
#1949
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: hotfix-0905
Are you sure you want to change the base?
Cherry pick https://github.com/pingcap/ticdc/pull/1922
#1949
Conversation
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.
Summary of Changes
Hello @hongyunyan, 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 is a cherry-pick that primarily focuses on improving code organization and enhancing the changefeed scheduling capabilities. It centralizes sink scheme helper functions into a common configuration package and introduces a new EnableSplittableCheck
option. This option refines how tables are distributed and split across nodes, with an automatic adjustment for MySQL-compatible sinks to maintain data integrity. The changes aim to make the system more robust and configurable regarding data distribution.
Highlights
- Refactoring of Sink Scheme Helpers: All sink scheme-related constants and helper functions (e.g., IsMySQLCompatibleScheme, GetScheme) have been moved from
downstreamadapter/sink/helper
topkg/config/sink_protocol.go
for better organization and reusability across the codebase. - Introduction of EnableSplittableCheck Configuration: A new configuration option,
EnableSplittableCheck
, has been added toChangefeedSchedulerConfig
. This flag controls whether a table's splittability (presence of primary key/unique key) is checked before splitting it across nodes. - Automatic Adjustment for MySQL-Compatible Sinks: For MySQL-compatible downstream sinks, the
EnableSplittableCheck
option is now automatically set totrue
to ensure data consistency, overriding any user-defined values if necessary. - Updated Table Splitting Logic: The internal logic for splitting tables across nodes has been updated to incorporate the
EnableSplittableCheck
flag, allowing for more flexible or stricter splitting behavior based on the sink type and configuration.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 primarily refactors sink-related helper functions and constants by moving them from downstreamadapter/sink/helper
to the pkg/config
package, which improves code organization. It also introduces a new enable-splittable-check
configuration to control table splitting behavior, which is now also enabled on single-node deployments. The changes are mostly clean, but a logic change related to table splitting could be made clearer to improve maintainability.
@@ -142,7 +145,7 @@ func (c *Controller) AddNewTable(table commonEvent.Table, startTs uint64) { | |||
EndKey: span.EndKey, | |||
} | |||
tableSpans := []*heartbeatpb.TableSpan{tableSpan} | |||
if c.enableTableAcrossNodes && table.Splitable && c.splitter != nil && c.nodeManager != nil && len(c.nodeManager.GetAliveNodes()) > 1 { | |||
if c.enableTableAcrossNodes && c.splitter != nil && (table.Splitable || !c.enableSplittableCheck) { |
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.
The condition for splitting tables has been changed to allow splitting on a single node by removing the len(c.nodeManager.GetAliveNodes()) > 1
check. While this enables a new capability, it also changes the behavior of the enableTableAcrossNodes
flag, which now controls table splitting in general, not just across nodes. This could be confusing for future maintainers. Consider adding a comment to clarify that table splitting is now supported on a single node when this flag is enabled.
[LGTM Timeline notifier]Timeline:
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lidezhu The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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