diff options
Diffstat (limited to 'jstests/sharding/set_user_write_block_mode.js')
-rw-r--r-- | jstests/sharding/set_user_write_block_mode.js | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/jstests/sharding/set_user_write_block_mode.js b/jstests/sharding/set_user_write_block_mode.js index 9fa4979712c..21108e95ccb 100644 --- a/jstests/sharding/set_user_write_block_mode.js +++ b/jstests/sharding/set_user_write_block_mode.js @@ -13,22 +13,7 @@ load("jstests/libs/fail_point_util.js"); load('jstests/libs/parallel_shell_helpers.js'); - -function removeShard(shardName) { - assert.soon(function() { - let res = assert.commandWorked(st.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; - } - return res.state == 'completed'; - }); -} +load('jstests/sharding/libs/remove_shard_util.js'); const st = new ShardingTest({shards: 2}); @@ -74,7 +59,7 @@ newShard.initiate(); // shard. assert.commandWorked(st.s.getDB(newShardDB).dropDatabase()); assert.commandWorked(st.s.adminCommand({setUserWriteBlockMode: 1, global: true})); - removeShard(newShardName); + removeShard(st, newShardName); // Disable write blocking while 'newShard' is not part of the cluster. assert.commandWorked(st.s.adminCommand({setUserWriteBlockMode: 1, global: false})); |