2010-05-25 02:33:01 +02:00
|
|
|
// check that there is preallocation on explicit createCollection() and no unncessary preallocation after restart
|
2010-01-20 02:20:34 +01:00
|
|
|
|
2010-05-25 02:33:01 +02:00
|
|
|
port = allocatePorts( 1 )[ 0 ];
|
2010-01-20 00:11:21 +01:00
|
|
|
|
2010-05-25 02:33:01 +02:00
|
|
|
var baseName = "jstests_preallocate2";
|
2010-01-20 00:11:21 +01:00
|
|
|
|
2010-01-20 02:20:34 +01:00
|
|
|
var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName );
|
2010-01-20 00:11:21 +01:00
|
|
|
|
2010-05-25 02:33:01 +02:00
|
|
|
assert.eq( 0, m.getDBs().totalSize );
|
|
|
|
|
2010-01-20 00:11:21 +01:00
|
|
|
m.getDB( baseName ).createCollection( baseName + "1" );
|
|
|
|
|
2010-05-25 02:33:01 +02:00
|
|
|
assert.soon( function() { return m.getDBs().totalSize > 100000000; }, "expected second file to bring total size over 100MB" );
|
|
|
|
|
2010-01-20 02:20:34 +01:00
|
|
|
stopMongod( port );
|
2010-01-20 00:11:21 +01:00
|
|
|
|
2010-01-20 02:20:34 +01:00
|
|
|
var m = startMongoProgram( "mongod", "--port", port, "--dbpath", "/data/db/" + baseName );
|
2010-01-20 00:11:21 +01:00
|
|
|
|
2010-01-26 01:48:49 +01:00
|
|
|
size = m.getDBs().totalSize;
|
|
|
|
|
2010-01-20 00:11:21 +01:00
|
|
|
m.getDB( baseName ).createCollection( baseName + "2" );
|
|
|
|
|
2010-01-26 01:48:49 +01:00
|
|
|
sleep( 2000 ); // give prealloc a chance
|
|
|
|
|
|
|
|
assert.eq( size, m.getDBs().totalSize );
|