summaryrefslogtreecommitdiff
path: root/jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js
diff options
context:
space:
mode:
authorMarcos José Grillo Ramírez <marcos.grillo@mongodb.com>2020-06-26 19:55:42 +0200
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-30 10:51:54 +0000
commit54cc38653d534ae51c6153e04d52ee7c58aa5b6e (patch)
tree7d4b04887514fb124c7b03ab5437b07a50835e47 /jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js
parente3304d5987789d71f297801cdc037acda60d3c55 (diff)
downloadmongo-54cc38653d534ae51c6153e04d52ee7c58aa5b6e.tar.gz
SERVER-48699 Changed refine key test to prevent premature timeouts on slow machines
Diffstat (limited to 'jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js')
-rw-r--r--jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js32
1 files changed, 17 insertions, 15 deletions
diff --git a/jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js b/jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js
index 352b4190d63..8d66d5095b9 100644
--- a/jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js
+++ b/jstests/sharding/range_deleter_interacts_correctly_with_refine_shard_key.js
@@ -135,24 +135,25 @@ function test(st, description, testBody) {
// The index on the original shard key shouldn't be required anymore.
assert.commandWorked(st.s.getCollection(ns).dropIndex(originalShardKey));
- // We will use this to wait until the following migration has completed, since we
- // expect the client to time out. Waiting for this failpoint technically just waits for
- // the recipient side of the migration to complete, but it's expected that if the
- // migration can get to that point, then it should be able to succeed overall.
+ // We will use this to wait until the following migration has completed. Waiting for
+ // this failpoint technically just waits for the recipient side of the migration to
+ // complete, but it's expected that if the migration can get to that point, then it
+ // should be able to succeed overall.
let hangDonorAtEndOfMigration =
configureFailPoint(st.rs1.getPrimary(), "moveChunkHangAtStep6");
- jsTestLog("Attempting to move the chunk back to shard 0");
- // Attempt to move the chunk back to shard 0, sending it with maxTimeMS. Since there
- // will be orphaned documents still on shard 0 (because range deletion is paused), we
- // expected this command to time out.
- assert.commandFailedWithCode(st.s.adminCommand({
- moveChunk: ns,
- find: refinedShardKeyValueInChunk,
- to: st.shard0.shardName,
- maxTimeMS: 1000
- }),
- ErrorCodes.MaxTimeMSExpired);
+ // Attempt to move the chunk back to shard 0. Synchronize with the parallel shell to
+ // make sure that the moveChunk started.
+ let hangOnStep1 = configureFailPoint(st.rs1.getPrimary(), "moveChunkHangAtStep1");
+ const awaitResult = startParallelShell(
+ funWithArgs(function(ns, toShardName, middle) {
+ jsTestLog("Attempting to move the chunk back to shard 0");
+ assert.commandWorked(
+ db.adminCommand({moveChunk: ns, find: middle, to: toShardName}));
+ }, ns, st.shard0.shardName, refinedShardKeyValueInChunk), st.s.port);
+
+ hangOnStep1.wait();
+ hangOnStep1.off();
// Hang after waiting for orphan cleanup so that in the test we can check for orphans
// on disk before documents begin migrating.
@@ -174,6 +175,7 @@ function test(st, description, testBody) {
// Wait for the previous migration to complete before continuing.
hangDonorAtEndOfMigration.wait();
hangDonorAtEndOfMigration.off();
+ awaitResult();
});
test(st,