diff options
Diffstat (limited to 's/client.cpp')
-rw-r--r-- | s/client.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/s/client.cpp b/s/client.cpp index 0da05b6..9058b31 100644 --- a/s/client.cpp +++ b/s/client.cpp @@ -141,7 +141,7 @@ namespace mongo { if ( shards->size() == 1 ) { string theShard = *(shards->begin() ); - ShardConnection conn( theShard , "", true ); + ShardConnection conn( theShard , "" ); BSONObj res; bool ok = false; @@ -150,7 +150,7 @@ namespace mongo { } catch( std::exception &e ){ - warning() << "could not get last error." << causedBy( e ) << endl; + warning() << "could not get last error from shard " << theShard << causedBy( e ) << endl; // Catch everything that happens here, since we need to ensure we return our connection when we're // finished. @@ -172,7 +172,14 @@ namespace mongo { continue; ShardConnection conn( temp , "" ); - _addWriteBack( writebacks , conn->getLastErrorDetailed() ); + + try { + _addWriteBack( writebacks , conn->getLastErrorDetailed() ); + } + catch( std::exception &e ){ + warning() << "could not clear last error from shard " << temp << causedBy( e ) << endl; + } + conn.done(); } clearSinceLastGetError(); @@ -183,7 +190,13 @@ namespace mongo { // ok } else { - assert( v.size() == 1 ); + // this will usually be 1 + // it can be greater than 1 if a write to a different shard + // than the last write op had a writeback + // all we're going to report is the first + // since that's the current write + // but we block for all + assert( v.size() >= 1 ); result.appendElements( v[0] ); result.appendElementsUnique( res ); result.append( "writebackGLE" , v[0] ); @@ -211,7 +224,7 @@ namespace mongo { for ( set<string>::iterator i = shards->begin(); i != shards->end(); i++ ) { string theShard = *i; bbb.append( theShard ); - ShardConnection conn( theShard , "", true ); + ShardConnection conn( theShard , "" ); BSONObj res; bool ok = false; try { @@ -223,7 +236,7 @@ namespace mongo { // Safe to return here, since we haven't started any extra processing yet, just collecting // responses. - warning() << "could not get last error." << causedBy( e ) << endl; + warning() << "could not get last error from a shard " << theShard << causedBy( e ) << endl; conn.done(); return false; @@ -262,7 +275,12 @@ namespace mongo { continue; ShardConnection conn( temp , "" ); - _addWriteBack( writebacks, conn->getLastErrorDetailed() ); + try { + _addWriteBack( writebacks, conn->getLastErrorDetailed() ); + } + catch( std::exception &e ){ + warning() << "could not clear last error from a shard " << temp << causedBy( e ) << endl; + } conn.done(); } clearSinceLastGetError(); |