diff --git a/s/chunk.cpp b/s/chunk.cpp index a2aa3cccf88..590e6c7f5e2 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -427,10 +427,10 @@ namespace mongo { assert( toMove ); - Shard newLocation = Shard::pick(); + Shard newLocation = Shard::pick( getShard() ); if ( getShard() == newLocation ){ - // if this is the best server, then we shouldn't do anything! - log(1) << "not moving chunk: " << toString() << " b/c would move to same place " << newLocation.toString() << " -> " << getShard().toString() << endl; + // if this is the best shard, then we shouldn't do anything (Shard::pick already logged our shard). + log(1) << "recently split chunk: " << toString() << "already in the best shard" << endl; return 0; } diff --git a/s/shard.cpp b/s/shard.cpp index 9295f351e3a..b9fa3d273ec 100644 --- a/s/shard.cpp +++ b/s/shard.cpp @@ -219,7 +219,7 @@ namespace mongo { staticShardInfo.remove( name ); } - Shard Shard::pick( const Shard& exclude ){ + Shard Shard::pick( const Shard& current ){ vector all; staticShardInfo.getAllShards( all ); if ( all.size() == 0 ){ @@ -229,27 +229,19 @@ namespace mongo { return EMPTY; } - // if provided, do not consider the 'exclude' shard as a viable candidate - if ( exclude != EMPTY ){ - for ( vector::iterator it= all.begin() ; it != all.end() ; ++it ){ - if ( exclude == *it ){ - all.erase( it ); - break; - } - } - if ( all.size() == 0 ) - return EMPTY; - } - + // if current shard was provided, pick a different shard only if it is a better choice ShardStatus best = all[0].getStatus(); - - for ( size_t i=1; i