diff options
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/disk/preallocate.js | 12 | ||||
-rw-r--r-- | jstests/disk/preallocate2.js | 11 | ||||
-rw-r--r-- | jstests/repl/basic1.js | 20 |
3 files changed, 37 insertions, 6 deletions
diff --git a/jstests/disk/preallocate.js b/jstests/disk/preallocate.js index c3c9bd0..d772fbb 100644 --- a/jstests/disk/preallocate.js +++ b/jstests/disk/preallocate.js @@ -1,15 +1,17 @@ -port = allocatePorts( 1 )[ 0 ]; +// check that there is preallocation on explicit createCollection() and no unncessary preallocation after restart -var baseName = "jstests_preallocate"; +port = allocatePorts( 1 )[ 0 ]; -vsize = function() { - return m.getDB( "admin" ).runCommand( "serverStatus" ).mem.virtual; -} +var baseName = "jstests_preallocate2"; var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName ); +assert.eq( 0, m.getDBs().totalSize ); + m.getDB( baseName ).createCollection( baseName + "1" ); +assert.soon( function() { return m.getDBs().totalSize > 100000000; }, "expected second file to bring total size over 100MB" ); + stopMongod( port ); var m = startMongoProgram( "mongod", "--port", port, "--dbpath", "/data/db/" + baseName ); diff --git a/jstests/disk/preallocate2.js b/jstests/disk/preallocate2.js new file mode 100644 index 0000000..ee9382c --- /dev/null +++ b/jstests/disk/preallocate2.js @@ -0,0 +1,11 @@ +// check that there is preallocation on insert + +port = allocatePorts( 1 )[ 0 ]; + +var baseName = "jstests_preallocate2"; + +var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName ); + +m.getDB( baseName )[ baseName ].save( {i:1} ); + +assert.soon( function() { return m.getDBs().totalSize > 100000000; }, "expected second file to bring total size over 100MB" );
\ No newline at end of file diff --git a/jstests/repl/basic1.js b/jstests/repl/basic1.js index 594ba07..0af26ac 100644 --- a/jstests/repl/basic1.js +++ b/jstests/repl/basic1.js @@ -121,12 +121,30 @@ t.update( { "b" : 3} , { $set : { "b.$" : 17 } } ) block(); check( "after pos 4 " ); - printjson( am.rpos.findOne() ) printjson( as.rpos.findOne() ) //am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().limit(10).sort( { $natural : -1 } ).forEach( printjson ) + +t = am.b; +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 6743} } , true, false) +block() +check( "b 1" ); + +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 5} } , true, false) +block() +check( "b 2" ); + +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 100, "a.b.c.y" : 911} } , true, false) +block() +assert.eq( { _id : "fun" , a : { b : { c : { x : 6848 , y : 911 } } } } , as.b.findOne() , "b 3" ); +//printjson( t.findOne() ) +//printjson( as.b.findOne() ) +//am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().sort( { $natural : -1 } ).limit(3).forEach( printjson ) +check( "b 4" ); + + rt.stop(); |