diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2013-01-22 13:53:52 -0500 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2013-01-22 16:10:18 -0500 |
commit | ededb03f2104f37cdb376e0f17a4d53b87f05cdf (patch) | |
tree | 8797c3f19c5283b5a2ea5de8bb9b91fcd6447fee /src/mongo | |
parent | 5c2f3da947dc5e7c5fec9561d315f51101467a1d (diff) | |
download | mongo-ededb03f2104f37cdb376e0f17a4d53b87f05cdf.tar.gz |
SERVER-8117: listDatabases - config/admin db should come from config servers
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/s/commands_admin.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mongo/s/commands_admin.cpp b/src/mongo/s/commands_admin.cpp index cd5aaaa69a2..292ae2038dc 100644 --- a/src/mongo/s/commands_admin.cpp +++ b/src/mongo/s/commands_admin.cpp @@ -1283,6 +1283,11 @@ namespace mongo { continue; } + if ( name == "config" || name == "admin" ) { + //always get this from the config servers + continue; + } + long long size = i->second; totalSize += size; @@ -1295,7 +1300,7 @@ namespace mongo { bb.append( temp.obj() ); } - if ( sizes.find( "config" ) == sizes.end() ){ + { // get config db from the config servers (first one) scoped_ptr<ScopedDbConnection> conn( ScopedDbConnection::getInternalScopedDbConnection( configServer.getPrimary() .getConnString() ) ); @@ -1316,6 +1321,27 @@ namespace mongo { conn->done(); } + { // get admin db from the config servers (first one) + scoped_ptr<ScopedDbConnection> conn( + ScopedDbConnection::getInternalScopedDbConnection( + configServer.getPrimary().getConnString(), 30)); + BSONObj x; + if ( conn->get()->simpleCommand( "admin" , &x , "dbstats" ) ){ + BSONObjBuilder b; + b.append( "name" , "admin" ); + b.appendBool( "empty" , false ); + if ( x["fileSize"].type() ) + b.appendAs( x["fileSize"] , "sizeOnDisk" ); + else + b.append( "sizeOnDisk" , 1 ); + bb.append( b.obj() ); + } + else { + bb.append( BSON( "name" << "admin" ) ); + } + conn->done(); + } + bb.done(); result.appendNumber( "totalSize" , totalSize ); |