mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
42 lines
692 B
JavaScript
42 lines
692 B
JavaScript
|
|
t = db.disk_reuse1;
|
|
t.drop();
|
|
|
|
N = 10000;
|
|
|
|
function k(){
|
|
return Math.floor( Math.random() * N );
|
|
}
|
|
|
|
s = "";
|
|
while ( s.length < 1024 )
|
|
s += "abc";
|
|
|
|
state = {}
|
|
|
|
for ( i=0; i<N; i++ )
|
|
t.insert( { _id : i , s : s } );
|
|
|
|
orig = t.stats();
|
|
|
|
t.remove();
|
|
|
|
for ( i=0; i<N; i++ )
|
|
t.insert( { _id : i , s : s } );
|
|
|
|
assert.eq( orig.storageSize , t.stats().storageSize , "A" )
|
|
|
|
for ( j=0; j<100; j++ ){
|
|
for ( i=0; i<N; i++ ){
|
|
var r = Math.random();
|
|
if ( r > .5 )
|
|
t.remove( { _id : i } )
|
|
else
|
|
t.insert( { _id : i , s : s } )
|
|
}
|
|
|
|
//printjson( t.stats() );
|
|
|
|
assert.eq( orig.storageSize , t.stats().storageSize , "B" + j )
|
|
}
|