summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2022-06-15 12:00:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-15 12:56:52 +0000
commit5d0cc8629dd4e3a527a148a3e9fb0fb6ac383ea1 (patch)
tree68ee75a7afd99f0da6240502ba84237ab4e05fe2 /jstests
parent74e9ca91e817dce50ca02d19c4930ac0321fc54d (diff)
downloadmongo-5d0cc8629dd4e3a527a148a3e9fb0fb6ac383ea1.tar.gz
SERVER-63036 Reintroduce balancer_defragmentation_merge_chunks.js into the csrs_continuous_config_stepdown suite
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/balancer_defragmentation_merge_chunks.js64
1 files changed, 2 insertions, 62 deletions
diff --git a/jstests/sharding/balancer_defragmentation_merge_chunks.js b/jstests/sharding/balancer_defragmentation_merge_chunks.js
index 8bb0cb601d2..ab6f75270fa 100644
--- a/jstests/sharding/balancer_defragmentation_merge_chunks.js
+++ b/jstests/sharding/balancer_defragmentation_merge_chunks.js
@@ -1,10 +1,11 @@
/**
* Test the configureCollectionBalancing command and balancerCollectionStatus command
*
- * // TODO (SERVER-63036): remove the 'does_not_support_stepdowns' tag
* @tags: [
* requires_fcv_53,
* featureFlagPerCollBalancingSettings,
+ * # This test does not support stepdowns of CSRS because of how it uses failpoints
+ * # to control phase transition
* does_not_support_stepdowns,
* ]
*/
@@ -97,67 +98,6 @@ function clearFailPointOnConfigNodes(failpoint) {
});
}
-function waitForFailpointOnConfigNodes(failpoint, timesEntered) {
- jsTest.log("Waiting for failpoint " + failpoint + ", times entered " + timesEntered);
- assert.soon(function() {
- let hitFailpoint = false;
- let csrs_nodes = [st.configRS.getPrimary()];
- csrs_nodes.concat(st.configRS.getSecondaries());
-
- csrs_nodes.forEach((config) => {
- let res = assert.commandWorkedOrFailedWithCode(config.adminCommand({
- waitForFailPoint: failpoint,
- timesEntered: timesEntered + 1,
- maxTimeMS: kDefaultWaitForFailPointTimeout / 10
- }),
- ErrorCodes.MaxTimeMSExpired);
- hitFailpoint = hitFailpoint || res["ok"] === 1;
- });
- return hitFailpoint;
- });
- jsTest.log("Failpoint " + failpoint + " hit " + timesEntered + " times");
-}
-
-jsTest.log("Split chunks while defragmenting");
-{
- st.stopBalancer();
- const coll = getNewColl();
- const nss = coll.getFullName();
- assert.commandWorked(st.s.adminCommand({shardCollection: nss, key: {skey: 1}}));
-
- const chunks = findChunksUtil.findChunksByNs(st.config, nss).toArray();
- assert.eq(1, chunks.length);
- assert.commandWorked(st.s.adminCommand({split: nss, middle: {skey: 0}}));
-
- const primaryShard = st.getPrimaryShard(coll.getDB().getName());
- assert.eq(st.normalize(primaryShard.name), st.normalize(chunks[0]['shard']));
- assert.commandWorked(
- st.s.adminCommand({moveChunk: nss, find: {skey: 0}, to: st.getOther(primaryShard).name}));
-
- // Pause defragmentation after initialization but before phase 1 runs
- setFailPointOnConfigNodes("afterBuildingNextDefragmentationPhase", {skip: 1});
- assert.commandWorked(st.s.adminCommand({
- configureCollectionBalancing: nss,
- defragmentCollection: true,
- chunkSize: targetChunkSizeMB,
- }));
- st.startBalancer();
-
- waitForFailpointOnConfigNodes("afterBuildingNextDefragmentationPhase", 0);
-
- assert.eq('moveAndMergeChunks',
- st.config.collections.findOne({_id: nss})['defragmentationPhase']);
- assert.eq(2, findChunksUtil.countChunksForNs(st.config, nss));
- assert.commandWorked(st.s.adminCommand({split: nss, middle: {skey: -10}}));
- assert.commandWorked(st.s.adminCommand({split: nss, middle: {skey: 10}}));
- assert.eq(4, findChunksUtil.countChunksForNs(st.config, nss));
-
- clearFailPointOnConfigNodes("afterBuildingNextDefragmentationPhase");
- defragmentationUtil.waitForEndOfDefragmentation(st.s, nss);
- // Ensure the defragmentation succeeded
- assert.eq(1, findChunksUtil.countChunksForNs(st.config, nss));
-}
-
// Setup collection for first tests
const coll1 = setupCollection();
const coll1Name = coll1.getFullName();