diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index 6cb83b7a7a369..60ee890541164 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -1135,8 +1135,10 @@ namespace mongo { } + long long size = nsd->datasize / scale; result.appendNumber( "count" , nsd->nrecords ); - result.appendNumber( "size" , nsd->datasize / scale ); + result.appendNumber( "size" , size ); + result.append ( "avgObjSize" , double(size) / double(nsd->nrecords) ); int numExtents; result.appendNumber( "storageSize" , nsd->storageSize( &numExtents ) / scale ); result.append( "numExtents" , numExtents ); @@ -1204,6 +1206,7 @@ namespace mongo { result.appendNumber( "collections" , ncollections ); result.appendNumber( "objects" , objects ); + result.append ( "avgObjSize" , double(size) / double(objects) ); result.appendNumber( "dataSize" , size ); result.appendNumber( "storageSize" , storageSize); result.appendNumber( "numExtents" , numExtents ); diff --git a/s/chunk.cpp b/s/chunk.cpp index 7fd4c31d08512..196536e587a8e 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -514,7 +514,8 @@ namespace mongo { ScopedDbConnection conn( temp.modelServer() ); - auto_ptr cursor = conn->query( temp.getNS() , BSON( "ns" << _ns ) ); + auto_ptr cursor = conn->query(temp.getNS(), QUERY("ns" << _ns).sort("lastmod",1), 0, 0, 0, 0, + (DEBUG_BUILD ? 2 : 1000000)); // batch size. Try to induce potential race conditions in debug builds while ( cursor->more() ){ BSONObj d = cursor->next(); if ( d["isMaxMarker"].trueValue() ){ diff --git a/s/commands_public.cpp b/s/commands_public.cpp index 94a3cfceab4ac..d565bdbe8df51 100644 --- a/s/commands_public.cpp +++ b/s/commands_public.cpp @@ -251,6 +251,7 @@ namespace mongo { result.append("ns", fullns); result.appendNumber("count", count); result.appendNumber("size", size); + result.append ("avgObjSize", double(size) / double(count)); result.appendNumber("storageSize", storageSize); result.append("nindexes", nindexes); diff --git a/shell/db.js b/shell/db.js index d2d75e00c41c3..2546bff48caf7 100644 --- a/shell/db.js +++ b/shell/db.js @@ -669,20 +669,23 @@ DB.prototype.listCommands = function(){ for ( var name in x.commands ){ var c = x.commands[name]; - var s = name + " lock: "; + var s = name + ": "; switch ( c.lockType ){ - case -1: s += "read"; break; - case 0: s += "node"; break; - case 1: s += "write"; break; + case -1: s += "read-lock"; break; + case 0: s += "no-lock"; break; + case 1: s += "write-lock"; break; default: s += c.lockType; } - s += " adminOnly: " + c.adminOnly; - s += " slaveOk: " + c.slaveOk; - s += " " + c.help; + if (c.adminOnly) s += " adminOnly "; + if (c.adminOnly) s += " slaveOk "; + + s += "\n "; + s += c.help.replace(/\n/g, '\n '); + s += "\n"; - print( s ) + print( s ); } } diff --git a/util/debug_util.h b/util/debug_util.h index cd59c89eb2aec..7686ecc9069fe 100644 --- a/util/debug_util.h +++ b/util/debug_util.h @@ -40,10 +40,12 @@ namespace mongo { } *OWS; #if defined(_DEBUG) -# define MONGO_DEV if( 1 ) + enum {DEBUG_BUILD = 1}; #else -# define MONGO_DEV if( 0 ) + enum {DEBUG_BUILD = 0}; #endif + +#define MONGO_DEV if( DEBUG_BUILD ) #define DEV MONGO_DEV #define MONGO_DEBUGGING if( 0 ) diff --git a/util/message.cpp b/util/message.cpp index 15b73a1c69e28..61a4175b410ae 100644 --- a/util/message.cpp +++ b/util/message.cpp @@ -251,12 +251,10 @@ namespace mongo { }; class Ports { - set& ports; + set ports; mongo::mutex m; public: - // we "new" this so it is still be around when other automatic global vars - // are being destructed during termination. - Ports() : ports( *(new set()) ), m("Ports") {} + Ports() : ports(), m("Ports") {} void closeAll() { \ scoped_lock bl(m); for ( set::iterator i = ports.begin(); i != ports.end(); i++ ) @@ -270,7 +268,11 @@ namespace mongo { scoped_lock bl(m); ports.erase(p); } - } ports; + }; + + // we "new" this so it is still be around when other automatic global vars + // are being destructed during termination. + Ports& ports = *(new Ports());