diff options
Diffstat (limited to 'jstests/sharding/balancer_defragmentation_merge_chunks.js')
-rw-r--r-- | jstests/sharding/balancer_defragmentation_merge_chunks.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/jstests/sharding/balancer_defragmentation_merge_chunks.js b/jstests/sharding/balancer_defragmentation_merge_chunks.js index aff6e9d6ba0..98bfdcce9cd 100644 --- a/jstests/sharding/balancer_defragmentation_merge_chunks.js +++ b/jstests/sharding/balancer_defragmentation_merge_chunks.js @@ -20,6 +20,8 @@ const st = new ShardingTest({ other: { enableBalancer: true, enableAutoSplit: true, + // Set global max chunk size to 1MB + chunkSize: 1, configOptions: {setParameter: {logComponentVerbosity: tojson({sharding: {verbosity: 2}})}}, } }); @@ -30,14 +32,6 @@ const db = st.getDB('db'); const collName = 'testColl'; let collCounter = 0; -// Set global max chunk size to 1MB -assert.soonNoExcept(() => { - let configDB = st.s.getDB('config'); - assert.commandWorked( - configDB["settings"].update({_id: "chunksize"}, {$set: {value: 1}}, {upsert: true})); - return true; -}); - // Shorten time between balancer rounds for faster initial balancing st.forEachConfigServer((conn) => { conn.adminCommand({ @@ -66,6 +60,12 @@ function setupCollection() { const fullNs = coll.getFullName(); assert.commandWorked(st.s.adminCommand({shardCollection: fullNs, key: {key: 1}})); + // "startBalancer" only guarantee that all the shards will EVENTUALLY enable the autosplitter. + // In order to ensure that all the shards have ALREADY enabled the autosplitter, we use the + // configureCollectionAutoSplitter command instead. + assert.commandWorked( + st.s.adminCommand({configureCollectionAutoSplitter: fullNs, enableAutoSplitter: true})); + let bulk = coll.initializeUnorderedBulkOp(); for (let i = 0; i < 12 * 128; i++) { bulk.insert({key: i, str: bigString}); |