Skip to content
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

checker(dm): port free space lightning precheck #7733

Merged
merged 18 commits into from
Dec 2, 2022

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Nov 28, 2022

Signed-off-by: lance6716 lance6716@gmail.com

What problem does this PR solve?

Issue Number: ref #3510

What is changed and how it works?

get source table size by SELECT data_length + index_length FROM information_schema.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? and use it in lightning prechecks

Check List

Tests

  • Integration test

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

`None`.

Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 28, 2022
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@lance6716 lance6716 changed the title [WIP]checker(dm): port cluster free space lightning precheck checker(dm): port cluster free space lightning precheck Nov 28, 2022
@ti-chi-bot ti-chi-bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 28, 2022
Signed-off-by: lance6716 <lance6716@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2022

Codecov Report

Merging #7733 (0221915) into master (6d24a57) will decrease coverage by 0.0113%.
The diff coverage is 63.3655%.

Additional details and impacted files
Flag Coverage Δ
cdc 66.3831% <79.5811%> (+0.0812%) ⬆️
dm 52.0045% <41.2820%> (-0.1808%) ⬇️
engine 64.3079% <60.9319%> (+0.3111%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@@               Coverage Diff                @@
##             master      #7733        +/-   ##
================================================
- Coverage   59.9034%   59.8921%   -0.0114%     
================================================
  Files           810        811         +1     
  Lines         93255      93675       +420     
================================================
+ Hits          55863      56104       +241     
- Misses        32535      32696       +161     
- Partials       4857       4875        +18     

@lance6716 lance6716 changed the title checker(dm): port cluster free space lightning precheck [WIP]checker(dm): port cluster free space lightning precheck Nov 28, 2022
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 28, 2022
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@lance6716
Copy link
Contributor Author

/run-dm-integration-test

Signed-off-by: lance6716 <lance6716@gmail.com>
@lance6716 lance6716 changed the title [WIP]checker(dm): port cluster free space lightning precheck checker(dm): port cluster free space lightning precheck Nov 29, 2022
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 29, 2022
if _, ok := c.checkingItems[config.LightningFreeSpaceChecking]; ok &&
c.stCfgs[0].LoaderConfig.ImportMode == config.LoadModePhysical &&
c.stCfgs[0].Mode != config.ModeIncrement {
// TODO: concurrently read it intra-source later
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is a bit large, I prefer fix it in next PR

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 29, 2022
@lance6716 lance6716 requested review from buchuitoudegou and lichunzhu and removed request for buchuitoudegou and lichunzhu November 29, 2022 10:36
@lance6716 lance6716 changed the title checker(dm): port cluster free space lightning precheck checker(dm): port free space lightning precheck Nov 30, 2022
Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

dm/config/checking_item.go Show resolved Hide resolved
dm/pkg/checker/lightning.go Outdated Show resolved Hide resolved
dm/checker/checker.go Outdated Show resolved Hide resolved
// members may have repeated meanings but have different data structure to satisfy different usages.
type tablePairInfo struct {
// downstream table -> sourceID -> upstream tables
tablesPerDownstreamTable map[filter.Table]map[string][]filter.Table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think PerXXX naming is quite hard to know what's inside, maybe targetTable2SourceTableMap, below too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's two name type: source/target and upstream/downstream. Do you prefer we always use source/target?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer source/target, they have less chars 😅, upstream/downstream are ok too

Signed-off-by: lance6716 <lance6716@gmail.com>
}
c.Assert(ValidateCheckingItem("xxx"), NotNil)
// remember to update the number when add new checking items.
require.Equal(t, 5, lightningCheck)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't check LightningPrechecksAllCheckingItems

// members may have repeated meanings but have different data structure to satisfy different usages.
type tablePairInfo struct {
// downstream table -> sourceID -> upstream tables
tablesPerDownstreamTable map[filter.Table]map[string][]filter.Table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer source/target, they have less chars 😅, upstream/downstream are ok too

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 30, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • D3Hunter
  • buchuitoudegou

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 30, 2022
Copy link
Contributor

@buchuitoudegou buchuitoudegou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

@@ -326,6 +329,10 @@ func (m *LoaderConfig) adjust() error {
m.PoolSize = defaultPoolSize
}

if m.Dir != "" && m.SortingDirPhysical == "" {
m.SortingDirPhysical = m.Dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why put the sorting-dir with source-dir? Lightning will prefer they are in different disk. Maybe we can set another default sorting-dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to do it in code 😂 and user may be unexpected to see another disk is occupied

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 Maybe just leave some comments to demonstrate the risk here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will be a precheck as I port more lightning precheck in future

dm/pkg/checker/lightning.go Outdated Show resolved Hide resolved
Co-authored-by: Obliviate <756541536@qq.com>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 1, 2022
@lance6716
Copy link
Contributor Author

/hold

I prefer we merge it after v6.5 branch is created

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 1, 2022
@lance6716
Copy link
Contributor Author

/unhold

/merge

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 2, 2022
@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5b157b9

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 2, 2022
@ti-chi-bot
Copy link
Member

@lance6716: 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.

@lance6716
Copy link
Contributor Author

/run-all-tests

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Dec 2, 2022
@lance6716
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 0105ac4

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 2, 2022
@lance6716
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot merged commit b953b42 into pingcap:master Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants