blob: caf50b85fc953f9ecd2f8139ef8d8288f03c32e8 (
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
35
36
37
38
39
40
41
42
43
44
45
46
|
// check that there is preallocation, and there are 2 files
var baseName = "jstests_preallocate";
var m = MongoRunner.runMongod({});
var getTotalNonLocalNonAdminSize = function() {
var totalNonLocalNonAdminDBSize = 0;
m.getDBs().databases.forEach(function(dbStats) {
// We accept the local database's and admin database's space overhead.
if (dbStats.name == "local" || dbStats.name == "admin")
return;
// Databases with "sizeOnDisk=1" and "empty=true" dont' actually take up space o disk.
// See SERVER-11051.
if (dbStats.sizeOnDisk == 1 && dbStats.empty)
return;
totalNonLocalNonAdminDBSize += dbStats.sizeOnDisk;
});
return totalNonLocalNonAdminDBSize;
};
assert.eq(0, getTotalNonLocalNonAdminSize());
m.getDB(baseName).createCollection(baseName + "1");
// Windows does not currently use preallocation
expectedMB = 64 + 16;
if (m.getDB(baseName).serverBits() < 64)
expectedMB /= 4;
assert.soon(function() {
return getTotalNonLocalNonAdminSize() >= expectedMB * 1024 * 1024;
}, "\n\n\nFAIL preallocate.js expected second file to bring total size over " + expectedMB + "MB");
MongoRunner.stopMongod(m);
m = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: m.dbpath});
size = getTotalNonLocalNonAdminSize();
m.getDB(baseName).createCollection(baseName + "2");
sleep(2000); // give prealloc a chance
assert.eq(size, getTotalNonLocalNonAdminSize());
|