-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Balance #3394
Balance #3394
Conversation
0970fe0
to
8ef5d52
Compare
8ef5d52
to
583e3b9
Compare
f6cc878
to
a52fb46
Compare
41ae899
to
813ea63
Compare
Can you put description of this PR at the beginning?
A clear description is as important as code. Thank you |
89f99bf
to
242d10d
Compare
242d10d
to
6271589
Compare
Codecov Report
@@ Coverage Diff @@
## master #3394 +/- ##
==========================================
- Coverage 85.19% 85.13% -0.07%
==========================================
Files 1304 1315 +11
Lines 121308 121302 -6
==========================================
- Hits 103352 103265 -87
- Misses 17956 18037 +81
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.
Half is done so far. Could you add more essential comments across files to help facilitate review and future reading from peers? Thank you!
sortedHosts.front()->parts_.emplace(partId); | ||
zone->partNum_++; | ||
HostAddr ha = sortedHosts.front()->ha_; | ||
for (size_t i = 0; i < sortedHosts.size() - 1; i++) { |
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 don't you loop the sorted hosts and find the first host which meets:
sortedHosts[i]->parts_.size() < sortedHosts[i + 1]
to avoid swap?
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 don't you loop the sorted hosts and find the first host which meets:
sortedHosts[i]->parts_.size() < sortedHosts[i + 1]
to avoid swap?
swap pointers is not performance sensitive and it's easy to understand
for (; newLeftIndex < leftEnd - 1; newLeftIndex++) { | ||
if (sortedActiveZones[newLeftIndex]->partNum_ > | ||
sortedActiveZones[newLeftIndex + 1]->partNum_) { | ||
std::swap(sortedActiveZones[newLeftIndex], sortedActiveZones[newLeftIndex + 1]); |
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 same, why not pick the right zone to insert to avoid swap?
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.
LGTM now, great work~
b332efb
to
aa58501
Compare
f2db882
to
691ad62
Compare
691ad62
to
112e6c5
Compare
nebula::kvstore::KVStore* kvStore_{nullptr}; | ||
AdminClient* adminClient_{nullptr}; | ||
|
||
std::mutex muReportFinish_; | ||
std::mutex muJobFinished_; | ||
std::atomic<JbmgrStatus> status_ = JbmgrStatus::NOT_START; |
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.
good job
|
||
/* first, move the lostZones' parts to the active zones | ||
* second, make balance for the active zones */ | ||
Status ZoneBalanceJobExecutor::buildBalancePlan() { |
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.
Good to see comments added!
112e6c5
to
6f5646e
Compare
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.
LGTM
What type of PR is this?
What does this PR do?
Which issue(s)/PR(s) this PR relates to?
#3169
#3432
Special notes for your reviewer, ex. impact of this fix, etc:
Additional context:
Checklist:
https://confluence.nebula-graph.io/pages/viewpage.action?pageId=10729589
Release notes:
Please confirm whether to reflect in release notes and how to describe: