summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Bique <alexandre.bique@mongodb.com>2021-02-02 15:11:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-05 12:13:19 +0000
commitb360736c85080cfbd8ccdd7c5edddc553a7f6285 (patch)
tree1e4afd525ca52bdffd6f3f52aea3da659dfbedf6
parenta967fd0ae4deb4888efa3185a8df77d869562717 (diff)
downloadmongo-b360736c85080cfbd8ccdd7c5edddc553a7f6285.tar.gz
SERVER-54131 zone_changes_range.js test has a race condition in runBalancer()
-rw-r--r--jstests/sharding/libs/zone_changes_util.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/jstests/sharding/libs/zone_changes_util.js b/jstests/sharding/libs/zone_changes_util.js
index 7d28f482cae..b6426aba10e 100644
--- a/jstests/sharding/libs/zone_changes_util.js
+++ b/jstests/sharding/libs/zone_changes_util.js
@@ -68,14 +68,17 @@ function moveZoneToShard(st, zoneName, fromShard, toShard) {
}
/**
- * Starts the balancer, lets it run for the given number of rounds, then stops the
- * balancer.
+ * Starts the balancer, lets it run for at least the given number of rounds,
+ * then stops the balancer.
*/
-function runBalancer(st, numRounds) {
+function runBalancer(st, minNumRounds) {
st.startBalancer();
- for (let i = 0; i < numRounds; i++) {
+
+ // We add 1 to the number of rounds to avoid a race condition
+ // where the first round is a no-op round
+ for (let i = 0; i < minNumRounds + 1; ++i)
st.awaitBalancerRound();
- }
+
st.stopBalancer();
}