Skip to content

Commit 8652841

Browse files
committed
Edited s/balancer_policy.cpp via GitHub
1 parent 18737bc commit 8652841

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

s/balancer_policy.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,11 @@ namespace mongo {
107107

108108
// Solving imbalances takes a higher priority than draining shards. Many shards can
109109
// be draining at once but we choose only one of them to cater to per round.
110+
// Important to start balanced, so when there are few chunks any imbalance must be fixed.
110111
const int imbalance = max.second - min.second;
111-
const int threshold = balancedLastTime ? 2 : 8;
112+
int threshold = 8;
113+
if (balancedLastTime || max.second < 20) threshold = 2;
114+
else if (max.second < 80) threshold = 4;
112115
string from, to;
113116
if ( imbalance >= threshold ) {
114117
from = max.first;

0 commit comments

Comments
 (0)