0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Merge branch 'master' of git@github.com:mongodb/mongo

This commit is contained in:
dwight 2010-08-02 12:16:08 -04:00
commit 609ee9cc8e
2 changed files with 7 additions and 3 deletions

View File

@ -1034,7 +1034,7 @@ namespace mongo {
virtual bool slaveOk() const { return true; }
virtual LockType locktype() const { return READ; }
virtual void help( stringstream &help ) const {
help << "{ collStats:\"blog.posts\" } ";
help << "{ collStats:\"blog.posts\" , scale : 1 } scale divides sizes e.g. for KB use 1024";
}
bool run(const string& dbname, BSONObj& jsobj, string& errmsg, BSONObjBuilder& result, bool fromRepl ){
string ns = dbname + "." + jsobj.firstElement().valuestr();
@ -1057,6 +1057,10 @@ namespace mongo {
}
}
else if ( jsobj["scale"].trueValue() ){
errmsg = "scale has to be a number > 0";
return false;
}
long long size = nsd->datasize / scale;
result.appendNumber( "count" , nsd->nrecords );

View File

@ -102,14 +102,14 @@ for ( i =0; i<100; i++ )
t.save( { _id : i } );
for ( i=0; i<100; i++ ){
t.find().batchSize( 2 ).next();
assert.lt( 0 , db.runCommand( "cursorInfo" ).total , "cursor1" );
assert.lt( 0 , db.runCommand( "cursorInfo" ).totalOpen , "cursor1" );
gc();
}
for ( i=0; i<100; i++ ){
gc();
}
assert.eq( 0 , db.runCommand( "cursorInfo" ).total , "cursor2" );
assert.eq( 0 , db.runCommand( "cursorInfo" ).totalOpen , "cursor2" );
print( "checkpoint E")