summaryrefslogtreecommitdiff
path: root/s/balancer_policy.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-06-18 21:24:54 +0200
committerAntonin Kral <a.kral@bobek.cz>2011-06-18 21:24:54 +0200
commitfefb1e355f6cbe35160f2f73ed68a38d95fa59a2 (patch)
treefaecb2fb6677516c5f6d9edfae8475344ddd73ed /s/balancer_policy.cpp
parentd95b46b2bbb5b4246213f252010508489b4e5719 (diff)
parent64b33ee522375a8dc15be2875dfb7db4502259b0 (diff)
downloadmongodb-fefb1e355f6cbe35160f2f73ed68a38d95fa59a2.tar.gz
Merge commit 'upstream/1.8.2'
Diffstat (limited to 's/balancer_policy.cpp')
-rw-r--r--s/balancer_policy.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/s/balancer_policy.cpp b/s/balancer_policy.cpp
index 2098a1f..482fab0 100644
--- a/s/balancer_policy.cpp
+++ b/s/balancer_policy.cpp
@@ -40,6 +40,8 @@ namespace mongo {
pair<string,unsigned> max("",0);
vector<string> drainingShards;
+ bool maxOpsQueued = false;
+
for (ShardToChunksIter i = shardToChunksMap.begin(); i!=shardToChunksMap.end(); ++i ) {
// Find whether this shard's capacity or availability are exhausted
@@ -67,6 +69,7 @@ namespace mongo {
// Draining shards take a lower priority than overloaded shards.
if ( size > max.second ) {
max = make_pair( shard , size );
+ maxOpsQueued = opsQueued;
}
if ( draining && (size > 0)) {
drainingShards.push_back( shard );
@@ -80,6 +83,11 @@ namespace mongo {
return NULL;
}
+ if ( maxOpsQueued ) {
+ log() << "biggest shard has unprocessed writebacks, waiting for completion of migrate" << endl;
+ return NULL;
+ }
+
log(1) << "collection : " << ns << endl;
log(1) << "donor : " << max.second << " chunks on " << max.first << endl;
log(1) << "receiver : " << min.second << " chunks on " << min.first << endl;