diff options
Diffstat (limited to 's/strategy_shard.cpp')
-rw-r--r-- | s/strategy_shard.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/s/strategy_shard.cpp b/s/strategy_shard.cpp index 2eca0c6..26ea79a 100644 --- a/s/strategy_shard.cpp +++ b/s/strategy_shard.cpp @@ -151,8 +151,10 @@ namespace mongo { // Many operations benefit from having the shard key early in the object o = manager->getShardKey().moveToFront(o); + const int maxTries = 10; + bool gotThrough = false; - for ( int i=0; i<10; i++ ) { + for ( int i=0; i<maxTries; i++ ) { try { ChunkPtr c = manager->findChunk( o ); log(4) << " server:" << c->getShard().toString() << " " << o << endl; @@ -165,7 +167,7 @@ namespace mongo { break; } catch ( StaleConfigException& ) { - log(1) << "retrying insert because of StaleConfigException: " << o << endl; + log( i < ( maxTries / 2 ) ) << "retrying insert because of StaleConfigException: " << o << endl; r.reset(); manager = r.getChunkManager(); } |