diff options
author | gregs <greg@10gen.com> | 2011-05-31 12:51:29 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-05-31 17:27:52 -0400 |
commit | 06882f6151e281aa314ce8659099ed21817da970 (patch) | |
tree | b526d8274aad8d8967152959db93328e47a2caba | |
parent | 3d531c70579a3ce8ef610e777f65903e66676141 (diff) | |
download | mongo-06882f6151e281aa314ce8659099ed21817da970.tar.gz |
wait for from writebacks in balancer CS-635
-rw-r--r-- | s/balancer_policy.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/s/balancer_policy.cpp b/s/balancer_policy.cpp index 2098a1f7faf..482fab06410 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; |