summaryrefslogtreecommitdiff
path: root/jstests/sharding/remove_shard_near_doc_size_limit.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/remove_shard_near_doc_size_limit.js')
-rw-r--r--jstests/sharding/remove_shard_near_doc_size_limit.js25
1 files changed, 2 insertions, 23 deletions
diff --git a/jstests/sharding/remove_shard_near_doc_size_limit.js b/jstests/sharding/remove_shard_near_doc_size_limit.js
index f1c32c37f72..648d936ff34 100644
--- a/jstests/sharding/remove_shard_near_doc_size_limit.js
+++ b/jstests/sharding/remove_shard_near_doc_size_limit.js
@@ -12,6 +12,7 @@
(function() {
'use strict';
+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",
@@ -43,28 +44,6 @@ assert.commandWorked(st.s.adminCommand({shardCollection: ns, key: {x: 1}}));
assert.commandWorked(st.s.adminCommand({split: ns, middle: {x: 0}}));
assert.commandWorked(st.s.adminCommand({moveChunk: ns, find: {x: 1}, to: st.shard1.shardName}));
-function removeShardAndWait(shardName) {
- const removeShardCmd = {removeShard: shardName};
- const res = st.s.adminCommand(removeShardCmd);
-
- assert.commandWorked(res);
- assert(res.state === "started");
-
- assert.soon(function() {
- let res = st.s.adminCommand(removeShardCmd);
- if (res.state === "completed") {
- return true;
- } else {
- jsTest.log("Still waiting for shard removal to complete:");
- printjson(res);
- assert.commandWorked(st.s.adminCommand({clearJumboFlag: ns, find: {"x": 1}}));
- return false;
- }
- });
-
- jsTest.log("Shard removal complete.");
-}
-
function assertDocsExist(shardKeys, numDocs, payloadSize) {
shardKeys.forEach(key => {
for (let i = 0; i < numDocs; i++) {
@@ -94,7 +73,7 @@ assert.commandWorked(st.s.getDB("config").settings.update(
{_id: "balancer"}, {$set: {attemptToBalanceJumboChunks: true}}, true));
st.startBalancer();
-removeShardAndWait(st.shard1.shardName);
+removeShard(st, st.shard1.shardName);
assertDocsExist(shardKeys, numDocs, bigDocSize);
st.stop();