diff options
Diffstat (limited to 's/strategy_single.cpp')
-rw-r--r-- | s/strategy_single.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/s/strategy_single.cpp b/s/strategy_single.cpp index fc206e5..a91ac2c 100644 --- a/s/strategy_single.cpp +++ b/s/strategy_single.cpp @@ -21,6 +21,7 @@ #include "cursors.h" #include "../client/connpool.h" #include "../db/commands.h" +#include "grid.h" namespace mongo { @@ -68,7 +69,15 @@ namespace mongo { throw e; loops--; - log() << "retrying command: " << q.query << endl; + log() << "retrying command: " << q.query << " (" << loops << " attempts remain)" << endl; + if( loops < 4 ){ + // In newer versions, can just use forceRemoteCheckShardVersion + DBConfigPtr conf = grid.getDBConfig( e.getns() ); + if ( conf ){ + conf->reload(); + conf->getChunkManagerIfExists( e.getns(), true, true ); + } + } ShardConnection::checkMyConnectionVersions( e.getns() ); } catch ( AssertionException& e ) { @@ -192,7 +201,7 @@ namespace mongo { for ( unsigned i=0; i<shards.size(); i++ ) { Shard shard = shards[i]; ScopedDbConnection conn( shard ); - BSONObj temp = conn->findOne( r.getns() , BSONObj() ); + BSONObj temp = conn->findOne( r.getns() , q.query ); if ( temp["inprog"].isABSONObj() ) { BSONObjIterator i( temp["inprog"].Obj() ); while ( i.more() ) { |