summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorDaniel Gómez Ferro <daniel.gomezferro@mongodb.com>2022-01-18 17:14:55 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-19 12:37:52 +0000
commitbd3f8756a321e70067e200b509b20c0795cc130b (patch)
treefa5053541d7e01229860e3fc4fb9e64bde8c2c07 /jstests
parent8cff596482240e32e1d8249b6043bc75987541ca (diff)
downloadmongo-bd3f8756a321e70067e200b509b20c0795cc130b.tar.gz
SERVER-62277 Add `freeStorage` option to dbstats, off by defaultr5.0.6-rc1
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/dbstats.js11
-rw-r--r--jstests/noPassthroughWithMongod/free_storage_size.js2
2 files changed, 10 insertions, 3 deletions
diff --git a/jstests/core/dbstats.js b/jstests/core/dbstats.js
index dff5e370702..76d77f29b5b 100644
--- a/jstests/core/dbstats.js
+++ b/jstests/core/dbstats.js
@@ -2,7 +2,7 @@
//
// @tags: [
// requires_dbstats,
-// requires_fcv_47,
+// requires_fcv_50
// ]
(function() {
@@ -34,7 +34,7 @@ const doc = {
};
assert.commandWorked(coll.insert(doc));
-let dbStats = testDB.runCommand({dbStats: 1});
+let dbStats = testDB.runCommand({dbStats: 1, freeStorage: 1});
assert.commandWorked(dbStats);
assert.eq(1, dbStats.objects, tojson(dbStats)); // Includes testColl only
@@ -61,6 +61,13 @@ if (isUsingPersistentStorage) {
assert(dbStats.hasOwnProperty("fsUsedSize"), tojson(dbStats));
assert(dbStats.hasOwnProperty("fsTotalSize"), tojson(dbStats));
+
+ // Make sure free storage size is not included by default
+ const defaultStats = testDB.runCommand({dbStats: 1});
+ assert.commandWorked(defaultStats);
+ assert(!defaultStats.hasOwnProperty("freeStorageSize"), tojson(defaultStats));
+ assert(!defaultStats.hasOwnProperty("indexFreeStorageSize"), tojson(defaultStats));
+ assert(!defaultStats.hasOwnProperty("totalFreeStorageSize"), tojson(defaultStats));
}
// Confirm collection and view counts on mongoD
diff --git a/jstests/noPassthroughWithMongod/free_storage_size.js b/jstests/noPassthroughWithMongod/free_storage_size.js
index 4c19cd13cf6..db16c671d6c 100644
--- a/jstests/noPassthroughWithMongod/free_storage_size.js
+++ b/jstests/noPassthroughWithMongod/free_storage_size.js
@@ -43,7 +43,7 @@ let collStats = assert.commandWorked(testDB.runCommand({collStats: collName}));
assert(collStats.hasOwnProperty("freeStorageSize"), tojson(collStats));
assert.gt(collStats.freeStorageSize, 0);
-let dbStats = assert.commandWorked(testDB.runCommand({dbStats: 1}));
+let dbStats = assert.commandWorked(testDB.stats({freeStorage: 1}));
assert(dbStats.hasOwnProperty("freeStorageSize"), tojson(dbStats));
assert.gt(dbStats.freeStorageSize, 0);
assert.eq(dbStats.freeStorageSize, collStats.freeStorageSize);