summaryrefslogtreecommitdiff
path: root/jstests/sharding/move_jumbo_chunk.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/move_jumbo_chunk.js')
-rw-r--r--jstests/sharding/move_jumbo_chunk.js20
1 files changed, 3 insertions, 17 deletions
diff --git a/jstests/sharding/move_jumbo_chunk.js b/jstests/sharding/move_jumbo_chunk.js
index b9239396132..9e3d75a9504 100644
--- a/jstests/sharding/move_jumbo_chunk.js
+++ b/jstests/sharding/move_jumbo_chunk.js
@@ -9,7 +9,8 @@
(function() {
'use strict';
-load("jstests/sharding/libs/find_chunks_util.js");
+load('jstests/sharding/libs/find_chunks_util.js');
+load('jstests/sharding/libs/remove_shard_util.js');
// TODO SERVER-50144 Remove this and allow orphan checking.
// This test calls removeShard which can leave docs in config.rangeDeletions in state "pending",
@@ -145,22 +146,7 @@ st.startBalancer();
// Now remove the shard that the jumbo chunk is on and make sure the chunk moves back to the other
// shard.
-let res = st.s.adminCommand({removeShard: st.shard1.shardName});
-assert.commandWorked(res);
-assert.soon(function() {
- res = st.s.adminCommand({removeShard: st.shard1.shardName});
- if (!res.ok && res.code === ErrorCodes.ShardNotFound) {
- // If the config server primary steps down right after removing the config.shards doc
- // for the shard but before responding with "state": "completed", the mongos would retry
- // the _configsvrRemoveShard command against the new config server primary, which would
- // not find the removed shard in its ShardRegistry if it has done a ShardRegistry reload
- // after the config.shards doc for the shard was removed. This would cause the command
- // to fail with ShardNotFound.
- return true;
- }
- assert.commandWorked(res);
- return ("completed" == res.state);
-}, "failed to remove shard");
+removeShard(st, st.shard1.shardName);
let jumboChunk = findChunksUtil.findOneChunkByNs(
st.getDB('config'), 'test.foo', {min: {$lte: {x: 0}}, max: {$gt: {x: 0}}});