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: allow balance-region-scheduler create multiple operators #4008

Closed
wants to merge 21 commits into from

Conversation

bufferflies
Copy link
Contributor

Signed-off-by: bufferflies [email protected]

What problem does this PR solve?

fix #3744, scheduler can generate some operators in scheduler time

What is changed and how it works?

Check List

Tests

  • Unit test

  • Manual test (add detailed scripts or steps below)

Code changes

Side effects

Related changes

Release note

Please add a release note.

If you don't think this PR needs a release note then fill it with None.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 19, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing

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 Aug 19, 2021
@ti-chi-bot ti-chi-bot requested review from disksing and nolouch August 19, 2021 06:51
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
@bufferflies bufferflies changed the title scheduler can generate many ops by once [scheduler]:scheduler can generate many ops by once Aug 20, 2021
@bufferflies bufferflies changed the title [scheduler]:scheduler can generate many ops by once scheduler:scheduler can generate many ops by once Aug 20, 2021
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
@codecov
Copy link

codecov bot commented Aug 20, 2021

Codecov Report

Merging #4008 (91b82a4) into master (5e0c212) will decrease coverage by 0.02%.
The diff coverage is 92.00%.

@@            Coverage Diff             @@
##           master    #4008      +/-   ##
==========================================
- Coverage   74.70%   74.67%   -0.03%     
==========================================
  Files         260      260              
  Lines       26625    26638      +13     
==========================================
+ Hits        19889    19893       +4     
- Misses       4950     4956       +6     
- Partials     1786     1789       +3     
Flag Coverage Δ
unittests 74.67% <92.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
server/schedulers/balance_region.go 88.63% <85.71%> (-0.54%) ⬇️
server/schedule/operator_controller.go 85.59% <100.00%> (+1.24%) ⬆️
server/schedulers/shuffle_hot_region.go 55.55% <0.00%> (-10.11%) ⬇️
server/id/id.go 76.19% <0.00%> (-4.77%) ⬇️
server/region_syncer/client.go 77.46% <0.00%> (-4.23%) ⬇️
pkg/etcdutil/etcdutil.go 84.70% <0.00%> (-3.53%) ⬇️
pkg/dashboard/adapter/manager.go 79.78% <0.00%> (-3.20%) ⬇️
server/server.go 71.40% <0.00%> (-0.45%) ⬇️
server/cluster/cluster.go 82.33% <0.00%> (-0.36%) ⬇️
client/client.go 72.50% <0.00%> (-0.14%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e0c212...91b82a4. Read the comment docs.

server/cluster/coordinator_test.go Outdated Show resolved Hide resolved
server/cluster/coordinator_test.go Outdated Show resolved Hide resolved
server/schedule/operator_controller.go Outdated Show resolved Hide resolved
@disksing disksing changed the title scheduler:scheduler can generate many ops by once scheduler: allow balance-region-scheduler create multiple operators Aug 23, 2021
Signed-off-by: bufferflies <[email protected]>
server/schedulers/balance_test.go Outdated Show resolved Hide resolved
server/schedulers/hot_region_config.go Outdated Show resolved Hide resolved
Signed-off-by: bufferflies <[email protected]>
server/schedulers/balance_test.go Outdated Show resolved Hide resolved
server/schedulers/balance_test.go Outdated Show resolved Hide resolved
server/schedulers/balance_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 25, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 29, 2021
@bufferflies bufferflies requested a review from rleungx September 22, 2021 02:56
Signed-off-by: bufferflies <[email protected]>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 11, 2021
Signed-off-by: bufferflies <[email protected]>
@@ -987,6 +987,7 @@ func (s *testOperatorControllerSuite) TestStoreOverloaded(c *C) {
opt.SetAllStoresLimit(storelimit.RemovePeer, 600)
time.Sleep(time.Second)
for i := 0; i < 10; i++ {

Copy link
Member

Choose a reason for hiding this comment

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

remove this line

@@ -1024,10 +1025,10 @@ func (s *testOperatorControllerSuite) TestStoreOverloadedWithReplace(c *C) {
c.Assert(oc.AddOperator(op2), IsTrue)
op3 := newTestOperator(1, tc.GetRegion(2).GetRegionEpoch(), operator.OpRegion, operator.AddPeer{ToStore: 1, PeerID: 3})
c.Assert(oc.AddOperator(op3), IsFalse)
c.Assert(lb.Schedule(tc), IsNil)
c.Assert(len(lb.Schedule(tc)), Equals, 0)
Copy link
Member

Choose a reason for hiding this comment

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

HasLen

@@ -51,6 +58,7 @@ func init() {
if err := decoder(conf); err != nil {
return nil, err
}
log.Info("conf", zap.Any("config", conf))
Copy link
Member

Choose a reason for hiding this comment

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

prefer to make it more clear, like balance region config?

@ti-chi-bot
Copy link
Member

@bufferflies: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@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 15, 2022
@nolouch nolouch mentioned this pull request Jan 25, 2022
@@ -43,6 +43,13 @@ func init() {
}
conf.Ranges = ranges
conf.Name = BalanceRegionName
conf.Batch = 1
if len(args) >= 3 {
Copy link
Member

Choose a reason for hiding this comment

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

args could be greater than 3 because there could be multi ranges

oc.PromoteWaitingOperator()
} else {
for i := 0; i < added; i++ {
oc.PromoteWaitingOperator()
Copy link
Member

Choose a reason for hiding this comment

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

should we check ops[id] is merge?

@@ -313,7 +312,17 @@ func (oc *OperatorController) AddWaitingOperator(ops ...*operator.Operator) int

oc.Unlock()
operatorWaitCounter.WithLabelValues(ops[0].Desc(), "promote-add").Inc()
oc.PromoteWaitingOperator()

if added > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

return as soon as possible so the maintainer needn't keep too many conditions in mind. For example, here we could return when we find added=0 so we needn't keep in mind the condition add=0 anymore.

Copy link
Member

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

ti-chi-bot added a commit that referenced this pull request Mar 14, 2022
…rs (#4652)

ref #4008, ref #4610

speed up balance leader by batch

Signed-off-by: Cabinfever_B <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
@nolouch
Copy link
Contributor

nolouch commented Jul 18, 2022

close it? I think the current bottleneck is the store limit. you can reopen it if needed.

@nolouch nolouch closed this Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance issues of balance-region-scheduler
7 participants