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

master(dm): specify worker when create upstream source #4167

Merged
merged 26 commits into from
Jan 28, 2022

Conversation

jerrylisl
Copy link
Contributor

@jerrylisl jerrylisl commented Dec 30, 2021

What problem does this PR solve?

Issue Number: close #4169

command "dmctl operate-source create" add param -w(worker) to specify a DM-worker to be bound.
when using this param, the command can't create multiple source

What is changed and how it works?

1.dmctl parses param "-w(worker)"
2.if the worker is specified, scheduler binds source to it

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Side effects

Related changes

  • Need to update the documentation

Release note

dmctl operate-source create specify DM-worker to be bound

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 30, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • 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 Denotes a PR that will be considered when it comes time to generate release notes. label Dec 30, 2021
@CLAassistant
Copy link

CLAassistant commented Dec 30, 2021

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot added the contribution This PR is from a community contributor. label Dec 30, 2021
@ti-chi-bot
Copy link
Member

Welcome @jerrylisl!

It looks like this is your first PR to pingcap/tiflow 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tiflow. 😃

@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 30, 2021
@lance6716 lance6716 added the area/dm Issues or PRs related to DM. label Dec 30, 2021
@lance6716 lance6716 changed the title dm: specify worker when create upstream source master(dm): specify worker when create upstream source Dec 30, 2021
@lance6716
Copy link
Contributor

Hi, do you need some help? we can discuss here or in slack or in asktug

@jerrylisl jerrylisl force-pushed the source_specify_worker branch from fbe3fe1 to 0e848f1 Compare January 7, 2022 04:06
@lance6716
Copy link
Contributor

/run-dm-integration-test

@lance6716
Copy link
Contributor

/run-verify

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 8, 2022
@lance6716
Copy link
Contributor

You can find our CI reports some test is broken with this feature, please take a look at idc-jenkins-ci-ticdc/dm-integration-test and jenkins-ticdc/verify (ignore the CDC part)

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.

thanks, please address my comments and fix the git conflict.

t.sourceCfgNotExist(c, s, sourceID2)
t.workerFree(c, s, workerName2)
c.Assert(s.AddSourceCfgWithWorker(&sourceCfg2, workerName1), IsNil)
// source2 is unbound because expected worker1 is already bound
Copy link
Contributor

@lance6716 lance6716 Jan 11, 2022

Choose a reason for hiding this comment

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

I'm not sure this behaviour is expected. In other words, if user want to add a source to a specific DM-worker, and the worker is not available (offline or already bound), should we bind the source to another worker, left the source unbound or remove the source?
Maybe you need this feature in your scenario, could you explain why you choose this bevaiour?

BTW, when DM-master failover, DM-master will try to bind andany unbound sources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

specific DM-worker only allow single source, user can do a transfer or remove the source quickly if the specific worker is not available, if we do something like bind the source to another worker (or remove it) can cause some extra "scheduling cost". And i think a "specify-worker" cmd bind a not specific worker may not be expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

a "specify-worker" cmd bind a not specific worker may not be expected

I got this.

How about we don't add the source when the specified worker is not available? I can list two reason:

  1. The command is more atomic, the effects all happen or nothing happen
  2. When the DM-master failovers, currently we will try to bind any unbound source, so the source may be bound to a unwanted worker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i'll modify this part and ci later.

@jerrylisl jerrylisl force-pushed the source_specify_worker branch from d5572cd to 9d6f538 Compare January 11, 2022 08:36
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 11, 2022
@jerrylisl
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor

@jerrylisl There are some unit test and linters failed, PTAL

and feel free to ask for help

@jerrylisl jerrylisl force-pushed the source_specify_worker branch from 0631eed to d1b984d Compare January 18, 2022 10:25
@jerrylisl
Copy link
Contributor Author

i've used "unit_test_pkg" in dm Makefile, is there any substitute in this repository?

@jerrylisl
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor

lint error: https://ci.pingcap.net/blue/organizations/jenkins/atom-lint/detail/atom-lint/5808/pipeline/

you can run make check and git add then commit repeatly, until make check passed.

one integration test fail: https://ci2.pingcap.net/blue/organizations/jenkins/dm_ghpr_integration_test/detail/dm_ghpr_integration_test/2936/pipeline

this is because we have a pattern matching for dmctl output, you should also update it

"operate-source <operate-type> \[config-file ...\] \[--print-sample-config\] \[flags\]" 1

unit test fail: https://ci.pingcap.net/blue/organizations/jenkins/atom-ut/detail/atom-ut/9927/tests/

you can cd into that directory and run commands like go test -check.f "testScheduler.TestWatchWorkerEventEtcdCompact" to run one test case. If the unit test uses failpoint, you should make failpoint-enable before run tests and make failpoint-disable after run tests

@lance6716
Copy link
Contributor

also, please sign the CLA #4167 (comment)

@lance6716
Copy link
Contributor

/run-dm-integration-test

1 similar comment
@lance6716
Copy link
Contributor

/run-dm-integration-test

@jerrylisl jerrylisl force-pushed the source_specify_worker branch from 1e72f7e to 53c0c3b Compare January 26, 2022 13:46
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 26, 2022
@lance6716
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 53c0c3b

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

/run-dm-integration-test
/run-verify

"list-member --name worker1" \
"\"stage\": \"bound\"" 1 \
"\"source\": \"mysql-replica-01\"" 1
dmctl_operate_source create $WORK_DIR/source2.yaml $SOURCE_ID2 -w $WORKER1_NAME
Copy link
Contributor

@lance6716 lance6716 Jan 27, 2022

Choose a reason for hiding this comment

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

CI failed,

[2022-01-27T03:23:23.958Z] dmctl test cmd: "operate-source create /tmp/dm_test/dmctl_command/source2.yaml"
[2022-01-27T03:23:25.335Z] dmctl test cmd: "operate-source create /tmp/dm_test/dmctl_command/source2.yaml -w wrong-worker"
[2022-01-27T03:23:25.335Z] dmctl test cmd: "operate-source create /tmp/dm_test/dmctl_command/source2.yaml -w worker1"
[2022-01-27T03:23:25.595Z] dmctl test cmd: "operate-source create /tmp/dm_test/dmctl_command/source2.yaml"
[2022-01-27T03:23:25.595Z] command: operate-source create /tmp/dm_test/dmctl_command/source2.yaml "result": true count: 0 != expected: 2
[2022-01-27T03:23:25.595Z] {
[2022-01-27T03:23:25.595Z]     "result": false,
[2022-01-27T03:23:25.595Z]     "msg": "[code=46007:class=scheduler:scope=internal:level=medium], Message: source config with ID mysql-replica-02 already exists",
[2022-01-27T03:23:25.595Z]     "sources": [
[2022-01-27T03:23:25.595Z]     ]
[2022-01-27T03:23:25.595Z] }

for line 89, I think create source2 on worker1 should failed because worker1 is bound to source1, but the script didn't detect the fail until it goes to line 98. Please fix it

@lance6716
Copy link
Contributor

/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 Jan 27, 2022
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Jan 27, 2022
@lance6716
Copy link
Contributor

/run-dm-integration-test

@jerrylisl
Copy link
Contributor Author

/run-dm-integration-test

@lance6716
Copy link
Contributor

/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 Jan 28, 2022
@ti-chi-bot
Copy link
Member

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

Commit hash: 317dd7d

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

/run-kafka-integration-test

@ti-chi-bot ti-chi-bot merged commit 2b45869 into pingcap:master Jan 28, 2022
niubell pushed a commit to niubell/tiflow that referenced this pull request Jan 28, 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. contribution This PR is from a community contributor. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

specify DM-worker instance when create upstream source
6 participants