summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2022-05-03 14:08:53 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-03 16:11:03 +0000
commit73938f0e9a74b4e45b7b134473ad8e3b36322a66 (patch)
treee5f9e6629b8141e721220f878f7d312bd669a691 /jstests
parent206098af2e7d120df5d1e82c1e94f6bf65644842 (diff)
downloadmongo-73938f0e9a74b4e45b7b134473ad8e3b36322a66.tar.gz
SERVER-66088 Create separate indexes for resharding test to drop.
Due to a StaleConfig exception, the _shardsvrDropIndexes command may automatically retry the dropIndexes command after the resharding operation has succeeded and lead to a spurious IndexNotFound error. While the _shardsvrDropIndexes and dropIndexes shard commands from the resharding_disallow_writes.js test have a maxTimeMSOpOnly attached, on platforms with less precise clocks (namely Windows), there may still be sufficient time for a retry to go through from the primary shard even after the initial dropIndexes request had timed out on mongos.
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/resharding_disallow_writes.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/jstests/sharding/resharding_disallow_writes.js b/jstests/sharding/resharding_disallow_writes.js
index 45a36e9c764..3a5a6e8f610 100644
--- a/jstests/sharding/resharding_disallow_writes.js
+++ b/jstests/sharding/resharding_disallow_writes.js
@@ -29,6 +29,8 @@ const sourceCollection = reshardingTest.createShardedCollection({
});
assert.commandWorked(sourceCollection.insert({_id: 0, oldKey: -20, newKey: 20, yak: 50}));
+assert.commandWorked(sourceCollection.createIndexes(
+ [{indexToDropDuringResharding: 1}, {indexToDropAfterResharding: 1}]));
const recipientShardNames = reshardingTest.recipientShardNames;
reshardingTest.withReshardingInBackground(
@@ -80,7 +82,7 @@ reshardingTest.withReshardingInBackground(
jsTestLog("Attempting drop index");
res = sourceCollection.runCommand(
- {dropIndexes: collName, index: {oldKey: 1}, maxTimeMS: 5000});
+ {dropIndexes: collName, index: {indexToDropDuringResharding: 1}, maxTimeMS: 5000});
assert(ErrorCodes.isExceededTimeLimitError(res.code));
jsTestLog("Completed operations");
@@ -107,7 +109,8 @@ assert.commandWorked(sourceCollection.runCommand(
assert.commandWorked(sourceCollection.runCommand({collMod: sourceCollection.getName()}));
-assert.commandWorked(sourceCollection.runCommand({dropIndexes: collName, index: {oldKey: 1}}));
+assert.commandWorked(
+ sourceCollection.runCommand({dropIndexes: collName, index: {indexToDropAfterResharding: 1}}));
assert.commandWorked(sourceCollection.runCommand({drop: collName}));