diff options
Diffstat (limited to 'jstests/sharding/libs/remove_shard_util.js')
| -rw-r--r-- | jstests/sharding/libs/remove_shard_util.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/jstests/sharding/libs/remove_shard_util.js b/jstests/sharding/libs/remove_shard_util.js deleted file mode 100644 index 4de2c17a461..00000000000 --- a/jstests/sharding/libs/remove_shard_util.js +++ /dev/null @@ -1,34 +0,0 @@ -function removeShard(shardingTestOrConn, shardName, timeout) { - if (timeout == undefined) { - timeout = 10 * 60 * 1000; // 10 minutes - } - - var s; - if (shardingTestOrConn instanceof ShardingTest) { - s = shardingTestOrConn.s; - } else { - s = shardingTestOrConn; - } - - assert.soon(function() { - let res; - if (TestData.configShard && shardName == "config") { - // Need to use transitionToDedicatedConfigServer if trying - // to remove config server as a shard - res = s.adminCommand({transitionToDedicatedConfigServer: shardName}); - } else { - res = s.adminCommand({removeShard: 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 res.state == 'completed'; - }, "failed to remove shard " + shardName + " within " + timeout + "ms", timeout); -} |
