summaryrefslogtreecommitdiff
path: root/jstests/sharding/scaled_collection_stats.js
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2021-04-29 12:08:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-30 08:30:28 +0000
commit467eed4bec3cb96559fd90ae5c8a1f36ddc073fa (patch)
treebbbaeefe3ff9b80a81364f93e05609065ba7125b /jstests/sharding/scaled_collection_stats.js
parent4eb1b48a2204fff78bf26965382381edd4a47085 (diff)
downloadmongo-467eed4bec3cb96559fd90ae5c8a1f36ddc073fa.tar.gz
SERVER-56153 Ensure that all data are flushed to disk before calculating the collection stats.
Diffstat (limited to 'jstests/sharding/scaled_collection_stats.js')
-rw-r--r--jstests/sharding/scaled_collection_stats.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/jstests/sharding/scaled_collection_stats.js b/jstests/sharding/scaled_collection_stats.js
index 30bebf5b53d..cc2da406562 100644
--- a/jstests/sharding/scaled_collection_stats.js
+++ b/jstests/sharding/scaled_collection_stats.js
@@ -26,6 +26,9 @@ assert.commandWorked(st.s.adminCommand({split: ns, middle: {_id: 0}}));
assert.commandWorked(st.s.adminCommand(
{moveChunk: ns, find: {_id: 0}, to: st.shard1.shardName, _waitForDelete: true}));
+// Ensure that all the inserted docs are on disk so that stats() returns up to date info.
+assert.commandWorked(st.s.adminCommand({fsync: 1}));
+
// Determine the unscaled index size.
let res = assert.commandWorked(coll.stats());
const totalIndexSize = res.totalIndexSize;