Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

mydumper: generate tables needed to dump for mydumper automatically (#310) #326

Merged
merged 19 commits into from
Oct 21, 2019

Conversation

sre-bot
Copy link

@sre-bot sre-bot commented Oct 18, 2019

cherry-pick #310 to release-1.0


What problem does this PR solve?

Now users need to add extra-args for mydumper to help it decide tables needed to dump. When the situations are very complicated it's very hard for users to do that. This PR aims to generate the tables needed to be dumped automatically so that we can simplify the configuration process.

What is changed and how it works?

Generate mydumper extra-args through black-white list and router rules when it is empty. Before start mydumper will connect to DB to fetch all the tables from database, filter useful tables and generate extra-args in --tables-list db1.tb1,db2.tb2.. format.
A unit-test is added to test whether it can generate right args when extra-args is empty. For integration_tests except "start_task" I expurge the extra-args to test whether it can run correctly.

Check List

Tests

  • Unit test
  • Integration test

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to be included in the release note

@sre-bot sre-bot added priority/normal Minor change, requires approval from ≥1 primary reviewer priority/release-blocker This PR blocks a release. Please review it ASAP. needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated type/cherry-pick This PR is just a cherry-pick (backport) labels Oct 18, 2019
@IANTHEREAL
Copy link
Collaborator

please fix this cherry pick @lichunzhu

@codecov
Copy link

codecov bot commented Oct 19, 2019

Codecov Report

Merging #326 into release-1.0 will not change coverage.
The diff coverage is n/a.

@@              Coverage Diff               @@
##           release-1.0       #326   +/-   ##
==============================================
  Coverage      59.9455%   59.9455%           
==============================================
  Files              135        135           
  Lines            15047      15047           
==============================================
  Hits              9020       9020           
  Misses            5151       5151           
  Partials           876        876

@@ -161,7 +162,8 @@ func (t *testServer) TestTaskAutoResume(c *C) {
// start task
cli := t.createClient(c, fmt.Sprintf("127.0.0.1:%d", port))
subtaskCfgBytes, err := ioutil.ReadFile("./subtask.toml")
_, err = cli.StartSubTask(context.Background(), &pb.StartSubTaskRequest{Task: string(subtaskCfgBytes)})
// strings.Replace is used here to uncomment extra-args to avoid mydumper connecting to DB and generating arg --tables-list which will cause failure
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it the only way to handle this problem? it's tricky

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I admit that. Perhaps we can add failpoint to solve this problem?

Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

LGTM

@csuzhangxc csuzhangxc added the status/LGT1 One reviewer already commented LGTM label Oct 21, 2019
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

LGTM

@WangXiangUSTC WangXiangUSTC added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Oct 21, 2019
@IANTHEREAL
Copy link
Collaborator

/run-all-tests

2 similar comments
@lichunzhu
Copy link
Contributor

/run-all-tests

@csuzhangxc
Copy link
Member

/run-all-tests

@lichunzhu lichunzhu merged commit 61ad0ca into pingcap:release-1.0 Oct 21, 2019
@csuzhangxc csuzhangxc added already-update-release-note The release note is updated. Add this label once the release note is updated and removed needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated labels Nov 1, 2019
@csuzhangxc csuzhangxc added already-update-docs The docs related to this PR already updated. Add this label once the docs are updated and removed needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated labels Mar 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-update-docs The docs related to this PR already updated. Add this label once the docs are updated already-update-release-note The release note is updated. Add this label once the release note is updated priority/normal Minor change, requires approval from ≥1 primary reviewer priority/release-blocker This PR blocks a release. Please review it ASAP. status/LGT2 Two reviewers already commented LGTM, ready for merge type/cherry-pick This PR is just a cherry-pick (backport)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants