-
Notifications
You must be signed in to change notification settings - Fork 288
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
scheduler(ticdc): add package keyspan #7731
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #7731 +/- ##
================================================
+ Coverage 59.9034% 59.9972% +0.0937%
================================================
Files 810 817 +7
Lines 93255 93856 +601
================================================
+ Hits 55863 56311 +448
- Misses 32535 32666 +131
- Partials 4857 4879 +22 |
Signed-off-by: Neil Shen <overvenus@gmail.com>
58f7258
to
30e0feb
Compare
// 4. Add table by DDL. | ||
// 5. Drop table by DDL. | ||
// 6. Some captures fail, does NOT affect spans. | ||
func (m *Reconciler) Reconcile( |
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 method looks quite complicated, is it possible to split it into multiple small methods?
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.
It's in performance critical path, splitting to multiple methods may lower its speed.
See https://gist.github.com/overvenus/475b333c7726a97d051e01484deb0bf0
} | ||
|
||
func (m *Reconciler) splitSpan(ctx context.Context, span tablepb.Span) []tablepb.Span { | ||
bo := tikv.NewBackoffer(ctx, 500) |
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.
can we move the bo
into the methods belonging to the regionCache
?
This makes the signature simpler.
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 RegionCache
here must be the same as tikv.RegionCache
, so that TiCDC compiles.
compat *compat.Compat, | ||
) []tablepb.Span { | ||
tablesLenEqual := len(currentTables) == len(m.tableSpans) | ||
tablesAllFind := true |
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 name tablesAllFind
is confusing
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.
Any suggestion? How about allTablsFound
?
// and for all tables in currentTables have a record in tableSpan. | ||
if !tablesLenEqual || !tablesAllFind { | ||
// The two sets are not identical. We need to find removed tables. | ||
intersectionTable := make(map[model.TableID]struct{}, len(currentTables)) |
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.
It is better to extract some func for set operation, it will be easy to test.
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.
Turns out we do not to find intersect tables. No more set operation now.
Signed-off-by: Neil Shen <overvenus@gmail.com>
/run-all-tests |
/run-all-tests |
/merge (This PR is essentially dead code for now, does not relate to tests failure) |
This pull request has been accepted and is ready to merge. Commit hash: 3ba052f
|
/run-all-tests |
/run-engine-integration-test |
/run-engine-integration-test |
@overvenus: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions 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 ti-community-infra/tichi repository. |
/run-all-tests |
/run-integration-test |
What problem does this PR solve?
Issue Number: ref #7720
What is changed and how it works?
Add
Reconciler
reconciles span and table mapping, make sure spans are in a desired state and covers all table ranges.Check List
Tests
Questions
Will it cause performance regression or break compatibility?
No.
Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note