From 64b33ee522375a8dc15be2875dfb7db4502259b0 Mon Sep 17 00:00:00 2001 From: Antonin Kral Date: Sat, 18 Jun 2011 21:24:41 +0200 Subject: Imported Upstream version 1.8.2 --- s/balancer_policy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 's/balancer_policy.cpp') 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 max("",0); vector 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; -- cgit v1.2.3