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 some precheck from lightning #7617

Merged
merged 12 commits into from
Nov 24, 2022

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Nov 15, 2022

What problem does this PR solve?

Issue Number: ref #3510

What is changed and how it works?

port some simple precheck from lightning

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

build a v7.0.0 TiDB

command: start-task /tmp/dm_test/lightning_mode/dm-task.yaml --remove-meta "result": true count: 0 != expected: 3
{
    "result": false,
    "msg": "",
    "sources": [
    ],
    "checkResult": "[code=26005:class=dm-master:scope=internal:level=medium], Message: fail to check synchronization configuration with type: check was failed, please see detail
        detail: {
                "results": [
                        {
                                "id": 12,
                                "name": "mysql_version",
                                "desc": "check whether mysql version is satisfied",
                                "state": "warn",
                                "errors": [
                                        {
                                                "severity": "warn",
                                                "short_error": "version suggested less than 8.0.0 but got 8.0.21"
                                        }
                                ],
                                "extra": "address of db instance - 127.0.0.1:3307"
                        },
                        {
                                "id": 24,
                                "name": "lightning_cluster_version",
                                "desc": "check downstream cluster version",
                                "state": "fail",
                                "errors": [
                                        {
                                                "severity": "fail",
                                                "short_error": "Cluster version check failed: [Lightning:Common:ErrVersionMismatch]TiDB version too new, expected to be within [4.0.0, 7.0.0), found '7.0.0'"
                                        }
                                ]
                        }
                ],
                "summary": {
                        "passed": false,
                        "total": 25,
                        "successful": 23,
                        "failed": 1,
                        "warning": 1
                }
        }"
}

Questions

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

Release note

`None`.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 15, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • 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 do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 15, 2022
@lance6716
Copy link
Contributor Author

#5289 need to fix this

Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/needs-linked-issue labels Nov 17, 2022
@lance6716 lance6716 changed the title [WIP]checker(dm): port some precheck from lightning checker(dm): port some precheck from lightning Nov 17, 2022
@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 17, 2022
@lance6716 lance6716 added the area/dm Issues or PRs related to DM. label Nov 17, 2022
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@lance6716
Copy link
Contributor Author

ptal @gozssky @lichunzhu

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Merging #7617 (0d952fa) into master (6d24a57) will decrease coverage by 0.0114%.
The diff coverage is 46.3576%.

Additional details and impacted files
Flag Coverage Δ
cdc 66.2698% <5.8823%> (-0.0321%) ⬇️
dm 52.1924% <51.4925%> (+0.0072%) ⬆️
engine 64.0284% <ø> (+0.0316%) ⬆️

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

@@               Coverage Diff                @@
##             master      #7617        +/-   ##
================================================
- Coverage   59.9034%   59.8920%   -0.0115%     
================================================
  Files           810        811         +1     
  Lines         93255      93343        +88     
================================================
+ Hits          55863      55905        +42     
- Misses        32535      32580        +45     
- Partials       4857       4858         +1     

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

@@ -330,6 +332,45 @@ func (c *Checker) Init(ctx context.Context) (err error) {
}
}

if instance.cfg.Mode != config.ModeIncrement && instance.cfg.LoaderConfig.ImportMode == config.LoadModePhysical {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need some checks for tidb backend?

Copy link
Contributor Author

@lance6716 lance6716 Nov 23, 2022

Choose a reason for hiding this comment

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

the checks in this PR is only for local backend because they are related to storage layer. I'll add more later

Copy link
Contributor

Choose a reason for hiding this comment

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

Does DM support local backend now? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

msg string
}

func (m mockPrecheckItem) Check(ctx context.Context) (*restore.CheckResult, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose we should add some integratoin test too? The unit test seems only mock the return result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's hard to generate such test case in the real cluster, I have a manually test with self-built TiDB in PR description

…-precheck

Signed-off-by: lance6716 <lance6716@gmail.com>
Copy link
Contributor

@lichunzhu lichunzhu 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. It sames that we will do all the lightning prechecks now?

dm/checker/checker.go Outdated Show resolved Hide resolved
Co-authored-by: Chunzhu Li <lichunzhu@stu.xjtu.edu.cn>
@lance6716
Copy link
Contributor Author

Rest LGTM. It sames that we will do all the lightning prechecks now?

There're more checks that need some adjustment to migrated into lightning in DM. For example, checking downstream has enough free space with dump files should be changed, because dump files are generated intermediately in the task.

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 24, 2022
// lightning prechecks
LightningEmptyRegionChecking: "lightning empty region checking item",
LightningRegionDistributionChecking: "lightning region distribution checking item",
LightningDownstreamVersionChecking: "lightning downstream version checking item",
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember we need to check the empty space for local backend. Is it necessary here?

@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 Nov 24, 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: a609857

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 24, 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

if err != nil {
return err
}
// bypass an Adjust error
Copy link
Contributor

Choose a reason for hiding this comment

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

what error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

// Adjust will raise error when this field is empty, so we set any non empty value here.


// Name implements the RealChecker interface.
func (c *LightningEmptyRegionChecker) Name() string {
return "lightning_empty_region"
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use config.LightningEmptyRegionChecking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

other checkers do not have same name with checking items. I'll ask PM

@lance6716
Copy link
Contributor Author

/hold

@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 Nov 24, 2022
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 Nov 24, 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 Nov 24, 2022
@ti-chi-bot
Copy link
Member

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

Commit hash: 15dc4d4

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

/run-all-tests

@lance6716
Copy link
Contributor Author

/check-issue-triage-complete

@ti-chi-bot ti-chi-bot merged commit e0bce5e into pingcap:master Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. 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.

8 participants