diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-06-08 17:15:24 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-06-08 17:15:24 -0400 |
commit | 8c4533a035cf981b72e48f73d4e33de881b95caa (patch) | |
tree | 62ef4f3796a163f689f14c2075465a5a0bb30e89 /s | |
parent | 93661510e975f9c8a62f315c6a602fecbf50cbfb (diff) | |
download | mongo-8c4533a035cf981b72e48f73d4e33de881b95caa.tar.gz |
add "n" to getLastError sharded SERVER-1204
Diffstat (limited to 's')
-rw-r--r-- | s/commands_admin.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/s/commands_admin.cpp b/s/commands_admin.cpp index 3770a26ae8d..179b46a1893 100644 --- a/s/commands_admin.cpp +++ b/s/commands_admin.cpp @@ -800,6 +800,7 @@ namespace mongo { bool ok = conn->runCommand( dbName , cmdObj , res ); result.appendElements( res ); conn.done(); + result.append( "singleShard" , theShard ); // hit other machines just to block for ( set<string>::iterator i=client->sinceLastGetError().begin(); i!=client->sinceLastGetError().end(); ++i ){ @@ -815,19 +816,29 @@ namespace mongo { return ok; } + BSONArrayBuilder bbb( result.subarrayStart( "shards" ) ); + + long long n = 0; + // hit each shard vector<string> errors; for ( set<string>::iterator i = shards->begin(); i != shards->end(); i++ ){ string theShard = *i; + bbb.append( theShard ); ShardConnection conn( theShard , "" ); BSONObj res; bool ok = conn->runCommand( dbName , cmdObj , res ); string temp = DBClientWithCommands::getLastErrorString( res ); if ( ok == false || temp.size() ) errors.push_back( temp ); + n += res["n"].numberLong(); conn.done(); } + bbb.done(); + + result.appendNumber( "n" , n ); + // hit other machines just to block for ( set<string>::iterator i=client->sinceLastGetError().begin(); i!=client->sinceLastGetError().end(); ++i ){ string temp = *i; |