Skip to content

Commit

Permalink
SERVER-7543 - don't over allocate extents, just round
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Nov 2, 2012
1 parent b4b2c54 commit f9b9242
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions jstests/capped_server7543.js
@@ -0,0 +1,11 @@

mydb = db.getSisterDB( "capped_server7543" );
mydb.dropDatabase();

mydb.createCollection( "foo" , { capped : true , size : 12288 } );

assert.eq( 12288, mydb.foo.stats().storageSize );
assert.eq( 1, mydb.foo.validate(true).extentCount );

mydb.dropDatabase();

4 changes: 3 additions & 1 deletion src/mongo/db/pdfile.cpp
Expand Up @@ -242,8 +242,10 @@ namespace mongo {
BSONElement e = options.getField("size");
if ( e.isNumber() ) {
size = e.numberLong();
size += 256;
size += 0xff;
size &= 0xffffffffffffff00LL;
if ( size < Extent::minSize() )
size = Extent::minSize();
}
}

Expand Down

0 comments on commit f9b9242

Please sign in to comment.