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

opt, schedulers: consider placement rules when verify region healthy #1897

Merged
merged 8 commits into from
Nov 7, 2019

Conversation

disksing
Copy link
Contributor

@disksing disksing commented Nov 5, 2019

Signed-off-by: disksing i@disksing.com

What problem does this PR solve?

continue merging placement rules.

What is changed and how it works?

  • replace core.RegionHealth with opt.RegionHealth. When placement rules is enabled, it allows learner peers.
  • replace core.RegionHealthAllowPending with opt.RegionHealthAllowPending. When placement rules is enabled, it allows learner peers.
  • replace len(region.GetPeers()) == cluster.GetMaxReplicas() with opt.IsRegionReplicated. When placement rules is enabled, it checks if peers can fit rules.

Check List

Tests

  • Unit test

@disksing disksing added the component/schedule Scheduling logic. label Nov 6, 2019
region.learners = learners
peers := region.meta.GetPeers()
for i := range peers {
for _, l := range learners {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just mention it, why not try to keep the same style of the loop like for j := range learners, then use learners[j] later instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only because l is shorter than learners[j].

Copy link
Member

@rleungx rleungx left a comment

Choose a reason for hiding this comment

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

LGTM.

server/schedulers/hot_region.go Outdated Show resolved Hide resolved
server/schedule/opt/healthy.go Outdated Show resolved Hide resolved
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

LGTM

@disksing
Copy link
Contributor Author

disksing commented Nov 7, 2019

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 7, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 7, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Nov 7, 2019

@disksing merge failed.

@lhy1024
Copy link
Contributor

lhy1024 commented Nov 7, 2019

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Nov 7, 2019

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/schedule Scheduling logic. status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants