-
Notifications
You must be signed in to change notification settings - Fork 719
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: refactor hotspot scheduler #2099
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2099 +/- ##
==========================================
- Coverage 76.66% 76.51% -0.15%
==========================================
Files 194 194
Lines 19756 19756
==========================================
- Hits 15146 15117 -29
- Misses 3478 3507 +29
Partials 1132 1132
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you test this version?
} | ||
} | ||
if id != 0 && bs.cluster.GetStore(id) == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a metrics when cannot select src store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code do not have such metric, so I don't think this should be added in this PR.
pendingOpInfos: pendingOpInfos, | ||
} | ||
ret := newHotScheduler(opController) | ||
ret.name = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why reset name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code didn't set name
, so it should be empty string.
server/schedulers/hot_region.go
Outdated
if len(candidateStoreIDs) == 0 { | ||
continue | ||
if pendings[movePeer] != nil || | ||
(pendings[transferLeader] != nil && !pendings[transferLeader].isDone()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add it in another PR.
/run-all-tests |
What problem does this PR solve?
The hotspot scheduler has duplicate code and its logic is not very clear.
What is changed and how it works?
Refactored the
hotScheduler
. Mainly three part:pendingOpInfos
related code (introduced by PR client: supports to add gRPC dial options (#2035) (#2043) #2046 and rename it toregionPendings
. (the 1st commit)balanceHot{Read, Write}Regions()
intobalanceBy{Peer, Leader}()
. (the 2ed commit)balanceSolver
to replacebalanceBy{Peer, Leader}()
. (the 4th & 5th commit).The reason for introducing
balanceSolver
is that the logic ofbalanceBy{Peer, Leader}()
are similar, which can be described generally asbalanceSolver.solve()
.Check List
Tests