2010-07-23 16:53:58 +02:00
|
|
|
// This should get skipped when testing replication
|
2010-06-15 00:47:12 +02:00
|
|
|
|
|
|
|
t = db.jstests_indexh;
|
|
|
|
|
2010-06-15 20:39:50 +02:00
|
|
|
function debug( t ) {
|
|
|
|
print( t );
|
|
|
|
}
|
|
|
|
|
2010-12-28 19:38:34 +01:00
|
|
|
function extraDebug() {
|
2010-12-28 23:29:06 +01:00
|
|
|
// printjson( db.stats() );
|
|
|
|
// db.printCollectionStats();
|
2010-12-28 19:38:34 +01:00
|
|
|
}
|
|
|
|
|
2010-06-15 00:47:12 +02:00
|
|
|
// index extent freeing
|
|
|
|
t.drop();
|
|
|
|
t.save( {} );
|
|
|
|
var s1 = db.stats().dataSize;
|
2010-06-15 20:39:50 +02:00
|
|
|
debug( "s1: " + s1 );
|
2010-12-28 19:38:34 +01:00
|
|
|
extraDebug();
|
2010-06-15 00:47:12 +02:00
|
|
|
t.ensureIndex( {a:1} );
|
|
|
|
var s2 = db.stats().dataSize;
|
2010-06-15 20:39:50 +02:00
|
|
|
debug( "s2: " + s2 );
|
2010-06-15 00:47:12 +02:00
|
|
|
assert.automsg( "s1 < s2" );
|
|
|
|
t.dropIndex( {a:1} );
|
2010-06-15 20:39:50 +02:00
|
|
|
var s3 = db.stats().dataSize;
|
|
|
|
debug( "s3: " + s3 );
|
2010-12-28 19:38:34 +01:00
|
|
|
extraDebug();
|
2010-06-15 20:39:50 +02:00
|
|
|
assert.eq.automsg( "s1", "s3" );
|
2010-06-15 00:47:12 +02:00
|
|
|
|
|
|
|
// index node freeing
|
|
|
|
t.drop();
|
|
|
|
t.ensureIndex( {a:1} );
|
2010-06-15 20:53:07 +02:00
|
|
|
for( i = 'a'; i.length < 500; i += 'a' ) {
|
|
|
|
t.save( {a:i} );
|
2010-06-15 00:47:12 +02:00
|
|
|
}
|
2010-06-15 20:39:50 +02:00
|
|
|
var s4 = db.stats().indexSize;
|
|
|
|
debug( "s4: " + s4 );
|
2010-06-15 00:47:12 +02:00
|
|
|
t.remove( {} );
|
2010-06-15 20:39:50 +02:00
|
|
|
var s5 = db.stats().indexSize;
|
|
|
|
debug( "s5: " + s5 );
|
|
|
|
assert.automsg( "s5 < s4" );
|