summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2022-01-05 14:44:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-05 15:42:32 +0000
commit619d0d3c24ca4b287098a343fb95c92e325c3d1b (patch)
tree906d708b5fb236f5552471c354c6fc1cadf3c9d7
parent46ebb678146598ce3ae12ae401732708e2e3cf01 (diff)
downloadmongo-619d0d3c24ca4b287098a343fb95c92e325c3d1b.tar.gz
SERVER-62268 Handle balancer configuration refresh in `balancer_defragmentation_merge_chunks.js`
-rw-r--r--jstests/sharding/balancer_defragmentation_merge_chunks.js16
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});