summaryrefslogtreecommitdiff
path: root/s/client.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-12-15 10:02:19 +0100
committerAntonin Kral <a.kral@bobek.cz>2011-12-15 10:02:46 +0100
commit0b48f8ada2acb0de830b23f8cefc8e3fea28d915 (patch)
treef7c2811269b6b53199412be2dd5ec02eea15d55d /s/client.cpp
parent85f1cd56145b90a32b7ccdc750000deeed54fe22 (diff)
parentf0d9a01bccdaeb466c12c92057914bbfef59526c (diff)
downloadmongodb-0b48f8ada2acb0de830b23f8cefc8e3fea28d915.tar.gz
Merge branch 'upstream/2.0.2'
Diffstat (limited to 's/client.cpp')
-rw-r--r--s/client.cpp32
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();