summaryrefslogtreecommitdiff
path: root/jstests/mmap_v1/extent2.js
blob: 269ac645986ac1d9f740a2a213cb0e886761cee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34


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

t = mydb.foo;

function insert() {
    t.insert({_id: 1, x: 1});
    t.insert({_id: 2, x: 1});
    t.insert({_id: 3, x: 1});
    t.ensureIndex({x: 1});
}

insert();
t.drop();

start = mydb.stats();

for (i = 0; i < 100; i++) {
    insert();
    t.drop();
}

end = mydb.stats();

printjson(start);
printjson(end);
assert.eq(start.extentFreeList.num, end.extentFreeList.num);

// 3: 1 data, 1 _id idx, 1 x idx
// used to be 4, but we no longer waste an extent for the freelist
assert.eq(3, start.extentFreeList.num);
assert.eq(3, end.extentFreeList.num);