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

scheduler(cdc): add randomness to the scheduler(V2) #4202

Merged
merged 8 commits into from
Jan 6, 2022

Conversation

liuzix
Copy link
Contributor

@liuzix liuzix commented Jan 4, 2022

What problem does this PR solve?

Issue Number: close #4203 close #4204 ref #3654

What is changed and how it works?

  • Introduced randomness to scheduler/balancer to 1) add some randomness in choosing dispatch target, 2) add some randomness in choosing victims when rebalancing.
  • Avoided copying table records when trying to find victims when rebalancing.

Check List

Tests

  • Unit test
  • Integration test

Performance

goos: linux
goarch: amd64
pkg: github.com/pingcap/tiflow/cdc/scheduler
cpu: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
BenchmarkAddTable
BenchmarkAddTable-16    	   10000	    519251 ns/op
PASS
  • With the changes
goos: linux
goarch: amd64
pkg: github.com/pingcap/tiflow/cdc/scheduler
cpu: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
BenchmarkAddTable
BenchmarkAddTable-16    	   76887	     14000 ns/op
PASS

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 4, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • overvenus

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 release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 4, 2022
@liuzix liuzix requested review from overvenus and amyangfei January 4, 2022 04:29
@liuzix liuzix added the area/ticdc Issues or PRs related to TiCDC. label Jan 4, 2022
@liuzix liuzix added this to the v5.4.0 milestone Jan 4, 2022
@liuzix liuzix added the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Jan 4, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2022

Codecov Report

Merging #4202 (f1d560d) into master (08da001) will increase coverage by 0.0146%.
The diff coverage is 53.0550%.

Flag Coverage Δ
cdc 58.5891% <57.2872%> (-0.0557%) ⬇️
dm 52.2819% <42.2746%> (+0.0273%) ⬆️

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

@@               Coverage Diff                @@
##             master      #4202        +/-   ##
================================================
+ Coverage   55.1722%   55.1868%   +0.0146%     
================================================
  Files           485        489         +4     
  Lines         59829      60605       +776     
================================================
+ Hits          33009      33446       +437     
- Misses        23484      23792       +308     
- Partials       3336       3367        +31     

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

Could you add a benchmark about addTable?

@liuzix
Copy link
Contributor Author

liuzix commented Jan 5, 2022

/run-leak-tests

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 5, 2022
@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 Jan 5, 2022
@overvenus
Copy link
Member

=== RUN   TestBalancerFindTargetTied
    balancer_test.go:234: 
        	Error Trace:	balancer_test.go:234
        	Error:      	Should be false
        	Test:       	TestBalancerFindTargetTied
--- FAIL: TestBalancerFindTargetTied (0.00s)

test fails

@liuzix
Copy link
Contributor Author

liuzix commented Jan 6, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 5f40346

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

/run-verify
/run-leak-test

@ti-chi-bot
Copy link
Member

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

ti-chi-bot added a commit that referenced this pull request Jan 6, 2022
zhaoxinyu pushed a commit to zhaoxinyu/ticdc that referenced this pull request Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 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
5 participants