summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordi Serra Torrens <jordi.serra-torrens@mongodb.com>2021-04-09 12:15:53 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-12 14:31:04 +0000
commit48253bc972fa18dcd82ad928d8408fccf54dac89 (patch)
treeea17aec12237bda1b5646b8306dac5896e383563
parented27ec70a2e4199b40465531451f3afd3570b9c8 (diff)
downloadmongo-48253bc972fa18dcd82ad928d8408fccf54dac89.tar.gz
SERVER-55973: resharding_disallow_drop.js is not waiting for resharding to acquire distLocks before attempting to drop the collection
-rw-r--r--jstests/sharding/resharding_disallow_drop.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/jstests/sharding/resharding_disallow_drop.js b/jstests/sharding/resharding_disallow_drop.js
index e6924195496..2404f7673e0 100644
--- a/jstests/sharding/resharding_disallow_drop.js
+++ b/jstests/sharding/resharding_disallow_drop.js
@@ -11,17 +11,13 @@
load("jstests/libs/fail_point_util.js");
load('jstests/libs/parallel_shell_helpers.js');
+// Ensures that resharding has acquired the db and collection distLocks. The fact that the entry in
+// config.reshardingOperations exists guarantees that the distLocks have already been acquired.
function awaitReshardingStarted() {
assert.soon(() => {
- const op = st.admin
- .aggregate([
- {$currentOp: {allUsers: true, localOps: true}},
- {$match: {"command.reshardCollection": ns}},
- ])
- .toArray()[0];
-
- return op !== undefined;
- }, "failed to find reshardCollection in $currentOp output");
+ const coordinatorDoc = st.s.getCollection("config.reshardingOperations").findOne({ns: ns});
+ return coordinatorDoc !== null;
+ }, "resharding didn't start");
}
var st = new ShardingTest({