summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-05-14 18:43:13 -0400
committerDan Pasette <dan@mongodb.com>2015-08-08 23:55:42 -0400
commit9c16e7062e68383103c8c9c09d14647f93352b19 (patch)
tree55018385561f485d95456c581c5d4d8670df84f4
parentcefd1536c84d05b71b7d9701bb44ea6d47ee8b3c (diff)
downloadmongo-9c16e7062e68383103c8c9c09d14647f93352b19.tar.gz
Don't assume storageSize doesn't change in background for all storage engines
(cherry picked from commit 5242bfe1117d20b34a35239b64ad3646d9b21e1e)
-rw-r--r--jstests/core/apitest_dbcollection.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/jstests/core/apitest_dbcollection.js b/jstests/core/apitest_dbcollection.js
index 7156a36bdaa..e63dde2a7d5 100644
--- a/jstests/core/apitest_dbcollection.js
+++ b/jstests/core/apitest_dbcollection.js
@@ -244,14 +244,19 @@ assert(db.getCollection( "test_db" ).getIndexes().length == 0,24);
t.save({a: 1});
var stats = assert.commandWorked(t.stats());
- assert.eq(stats.storageSize, t.storageSize());
assert.neq(undefined, t.storageSize(),
'db.collection.storageSize() cannot be undefined on a non-empty collection');
- assert.eq(stats.totalIndexSize, t.totalIndexSize());
assert.neq(undefined, t.totalIndexSize(),
'db.collection.totalIndexSize() cannot be undefined on a non-empty collection');
- assert.eq(t.storageSize() + t.totalIndexSize(), t.totalSize(),
- 'incorrect db.collection.totalSize() on a non-empty collection');
+
+ if (db.serverStatus()storageEngine.name === 'mmapv1') {
+ // Only in MMAPv1 do we guarantee that storageSize only changes when you write to a
+ // collection.
+ assert.eq(stats.storageSize, t.storageSize());
+ assert.eq(stats.totalIndexSize, t.totalIndexSize());
+ assert.eq(t.storageSize() + t.totalIndexSize(), t.totalSize(),
+ 'incorrect db.collection.totalSize() on a non-empty collection');
+ }
t.drop();
}());