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

DM: add checkpoint test for lightning-loader #3220

Merged
merged 21 commits into from
Nov 18, 2021

Conversation

Little-Wallace
Copy link
Contributor

Signed-off-by: Little-Wallace [email protected]

What problem does this PR solve?

What is changed and how it works?

Add checkpoint test for lightning tidb-backend. I hope we can use tidb-backend to replace loader of dm.

Check List

Tests

  • Integration test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update key monitor metrics in both TiCDC document and official document

Release note

None

Signed-off-by: Little-Wallace <[email protected]>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 1, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Ehco1996
  • lance6716

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 release-note-none Denotes a PR that doesn't merit a release note. label Nov 1, 2021
@CLAassistant
Copy link

CLAassistant commented Nov 1, 2021

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 1, 2021
dm/loader/lightning.go Outdated Show resolved Hide resolved
dm/loader/lightning.go Outdated Show resolved Hide resolved
dm/loader/lightning.go Outdated Show resolved Hide resolved
dm/cmd/dm-worker/main.go Outdated Show resolved Hide resolved
dm/loader/lightning.go Outdated Show resolved Hide resolved
err = l.core.RunOnce(taskCtx, cfg, nil)
err = l.runLightning(ctx, cfg)
if err == nil {
err = lightning.CheckpointRemove(ctx, cfg, "all")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can keep the checkpoint in target db and clear it when user start-task with flag remove-meta as syncer do

Copy link
Contributor

@glorv glorv Nov 2, 2021

Choose a reason for hiding this comment

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

+1. In the current dm implementation, we should delay clean checkpoint data when stop task

Copy link
Contributor

Choose a reason for hiding this comment

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

we at least should make sure IsFreshTask returning false after a successful loading, so it needs we don't remove lightning checkpoint or let IsFreshTask inspecting LightningCheckpointList

dm/tests/lightning_load_task/conf/dm-task.yaml Outdated Show resolved Hide resolved
@glorv glorv added the area/dm Issues or PRs related to DM. label Nov 2, 2021
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 3, 2021
Signed-off-by: Little-Wallace <[email protected]>
Signed-off-by: Little-Wallace <[email protected]>
@glorv glorv added the needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. label Nov 3, 2021
@Ehco1996
Copy link
Contributor

Ehco1996 commented Nov 4, 2021

/run-dm-integration-tests

dm/loader/lightning.go Outdated Show resolved Hide resolved
@@ -150,7 +180,8 @@ func (l *LightningLoader) restore(ctx context.Context) error {
}
cfg.Routes = l.cfg.RouteRules
cfg.Checkpoint.Driver = lcfg.CheckpointDriverMySQL
cfg.Checkpoint.Schema = config.TiDBLightningCheckpointPrefix + dbutil.ColumnName(l.workerName)
cfg.Checkpoint.Schema = config.TiDBLightningCheckpointPrefix + dbutil.TableName(l.workerName, l.cfg.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why we need dbutil.TableName, because in NewMySQLCheckpointsDB of lightning it will do escaping for backquotes 🤔

can we only use config.TiDBLightningCheckpointPrefix + l.workerName + l.cfg.Name as database name?

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 seems that can not pass test

dm/loader/lightning.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 4, 2021
Signed-off-by: Little-Wallace <[email protected]>
@Ehco1996
Copy link
Contributor

Ehco1996 commented Nov 8, 2021

ping @Little-Wallace

Signed-off-by: Little-Wallace <[email protected]>
Copy link
Contributor

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

I'll implement remove-meta for lightning checkpoint in another PR

dm/loader/checkpoint.go Outdated Show resolved Hide resolved
err = l.core.RunOnce(taskCtx, cfg, nil)
err = l.runLightning(ctx, cfg)
if err == nil {
err = lightning.CheckpointRemove(ctx, cfg, "all")
Copy link
Contributor

Choose a reason for hiding this comment

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

we at least should make sure IsFreshTask returning false after a successful loading, so it needs we don't remove lightning checkpoint or let IsFreshTask inspecting LightningCheckpointList

Signed-off-by: Little-Wallace <[email protected]>
Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

In future PR I'll check if we can use LightningCheckpointList to implement IsFreshTask, and implement --remove-meta for lightning loader

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 11, 2021
@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 11, 2021
@ti-chi-bot ti-chi-bot removed status/can-merge Indicates a PR has been approved by a committer. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 17, 2021
@lance6716
Copy link
Contributor

/run-all-tests

1 similar comment
@lance6716
Copy link
Contributor

/run-all-tests

@lance6716
Copy link
Contributor

/run-all-tests

1 similar comment
@lance6716
Copy link
Contributor

/run-all-tests

@lance6716
Copy link
Contributor

/run-all-tests

@lance6716
Copy link
Contributor

lance6716 commented Nov 17, 2021

[2021-11-17T11:56:09.722Z] [2021/11/17 19:56:04.010 +08:00] [ERROR] [lightning.go:248] ["failed to runlightning"] [task=test] [unit=lightning-load] [error="invalid value / unknown config name: cluster"] [errorVerbose="invalid value / unknown config name: cluster\ngithub.com/pingcap/errors.AddStack\n\t/nfs/cache/mod/github.com/pingcap/[email protected]/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/nfs/cache/mod/github.com/pingcap/[email protected]/juju_adaptor.go:15\ngithub.com/pingcap/tidb/br/pkg/lightning/common.(*MySQLConnectParam).Connect\n\t/nfs/cache/mod/github.com/pingcap/[email protected]/br/pkg/lightning/common/util.go:70\ngithub.com/pingcap/tidb/br/pkg/lightning/restore.DBFromConfig\n\t/nfs/cache/mod/github.com/pingcap/[email protected]/br/pkg/lightning/restore/tidb.go:96\ngithub.com/pingcap/tidb/br/pkg/lightning.CleanupMetas\n\t/nfs/cache/mod/github.com/pingcap/[email protected]/br/pkg/lightning/lightning.go:752\ngithub.com/pingcap/tidb/br/pkg/lightning.CheckpointRemove\n\t/nfs/cache/mod/github.com/pingcap/[email protected]/br/pkg/lightning/lightning.go:739\ngithub.com/pingcap/ticdc/dm/loader.(*LightningLoader).restore\n\t/home/jenkins/agent/workspace/dm_ghpr_integration_test/go/src/github.com/pingcap/ticdc/dm/loader/lightning.go:240\ngithub.com/pingcap/ticdc/dm/loader.(*LightningLoader).Process\n\t/home/jenkins/agent/workspace/dm_ghpr_integration_test/go/src/github.com/pingcap/ticdc/dm/loader/lightning.go:292\ngithub.com/pingcap/ticdc/dm/loader.(*LightningLoader).Resume\n\t/home/jenkins/agent/workspace/dm_ghpr_integration_test/go/src/github.com/pingcap/ticdc/dm/loader/lightning.go:350\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"]

"cluster" is the TLS name 🤔

@lance6716
Copy link
Contributor

/run-all-tests

@lance6716
Copy link
Contributor

/run-dm-integration-test

@lance6716
Copy link
Contributor

@ti-chi-bot
Copy link
Member

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

Commit hash: 7c5fd31

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

/unhold

@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 18, 2021
@lance6716
Copy link
Contributor

/run-integration-test

@codecov-commenter
Copy link

Codecov Report

Merging #3220 (7c5fd31) into master (24030f8) will increase coverage by 1.3053%.
The diff coverage is 68.6951%.

@@               Coverage Diff                @@
##             master      #3220        +/-   ##
================================================
+ Coverage   56.5356%   57.8409%   +1.3053%     
================================================
  Files           211        234        +23     
  Lines         22798      23983      +1185     
================================================
+ Hits          12889      13872       +983     
- Misses         8598       8711       +113     
- Partials       1311       1400        +89     

@ti-chi-bot ti-chi-bot merged commit eb64839 into pingcap:master Nov 18, 2021
ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Nov 18, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #3512.

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. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ 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.

9 participants