2015-01-14 19:39:54 +01:00
|
|
|
// Checks storage-engine specific sections of db.severStatus() output.
|
|
|
|
|
|
|
|
(function() {
|
2015-01-15 22:19:20 +01:00
|
|
|
'use strict';
|
2015-01-14 19:39:54 +01:00
|
|
|
|
|
|
|
// 'backgroundFlushing' is mmapv1-specific.
|
2015-03-22 17:08:21 +01:00
|
|
|
var mongo = MongoRunner.runMongod({smallfiles: ""});
|
2015-01-14 19:39:54 +01:00
|
|
|
var testDB = mongo.getDB('test');
|
|
|
|
var serverStatus = assert.commandWorked(testDB.serverStatus());
|
|
|
|
if (serverStatus.storageEngine.name == 'mmapv1') {
|
|
|
|
assert(serverStatus.backgroundFlushing,
|
|
|
|
'mmapv1 db.serverStatus() result must contain backgroundFlushing document: ' +
|
2016-03-09 18:17:50 +01:00
|
|
|
tojson(serverStatus));
|
|
|
|
} else {
|
2015-01-14 19:39:54 +01:00
|
|
|
assert(!serverStatus.backgroundFlushing,
|
|
|
|
'Unexpected backgroundFlushing document in non-mmapv1 db.serverStatus() result: ' +
|
2016-03-09 18:17:50 +01:00
|
|
|
tojson(serverStatus));
|
2015-01-14 19:39:54 +01:00
|
|
|
}
|
2015-03-22 17:08:21 +01:00
|
|
|
MongoRunner.stopMongod(mongo);
|
2015-01-14 19:56:16 +01:00
|
|
|
|
|
|
|
// 'dur' is mmapv1-specific and should only be generated when journaling is enabled.
|
2015-03-22 17:08:21 +01:00
|
|
|
mongo = MongoRunner.runMongod({smallfiles: "", journal: ""});
|
2015-01-14 19:56:16 +01:00
|
|
|
testDB = mongo.getDB('test');
|
|
|
|
serverStatus = assert.commandWorked(testDB.serverStatus());
|
|
|
|
if (serverStatus.storageEngine.name == 'mmapv1') {
|
2016-03-09 18:17:50 +01:00
|
|
|
assert(
|
|
|
|
serverStatus.dur,
|
|
|
|
'mmapv1 db.serverStatus() result must contain "dur" document: ' + tojson(serverStatus));
|
|
|
|
} else {
|
2015-01-14 19:56:16 +01:00
|
|
|
assert(!serverStatus.dur,
|
|
|
|
'Unexpected "dur" document in non-mmapv1 db.serverStatus() result: ' +
|
2016-03-09 18:17:50 +01:00
|
|
|
tojson(serverStatus));
|
2015-01-14 19:56:16 +01:00
|
|
|
}
|
2015-03-22 17:08:21 +01:00
|
|
|
MongoRunner.stopMongod(mongo);
|
|
|
|
mongo = MongoRunner.runMongod({smallfiles: "", nojournal: ""});
|
2015-01-14 19:56:16 +01:00
|
|
|
testDB = mongo.getDB('test');
|
|
|
|
serverStatus = assert.commandWorked(testDB.serverStatus());
|
|
|
|
assert(!serverStatus.dur,
|
|
|
|
'Unexpected "dur" document in db.serverStatus() result when journaling is disabled: ' +
|
2016-03-09 18:17:50 +01:00
|
|
|
tojson(serverStatus));
|
2015-03-22 17:08:21 +01:00
|
|
|
MongoRunner.stopMongod(mongo);
|
2015-01-14 19:39:54 +01:00
|
|
|
}());
|