diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2018-06-26 18:26:41 -0400 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2018-07-02 09:34:46 -0400 |
commit | b8533d84871c811573bc2c72576ee2aa51df42d8 (patch) | |
tree | bf204a94dceeff2adf540144e01787dab8dc5ec2 /pytests | |
parent | 6c89f126439b6c39a659bdfd787041541700b6c3 (diff) | |
download | mongo-b8533d84871c811573bc2c72576ee2aa51df42d8.tar.gz |
SERVER-35588 powertest.py should call replSetReconfigure command only after successful replSetGetConfig
(cherry picked from commit 0fdc2e40994c930a97aa213fa990423616bc5268)
Diffstat (limited to 'pytests')
-rwxr-xr-x | pytests/powertest.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/pytests/powertest.py b/pytests/powertest.py index a18425793c2..10ec6dc9b28 100755 --- a/pytests/powertest.py +++ b/pytests/powertest.py @@ -1475,7 +1475,20 @@ def mongo_reconfig_replication(mongo, host_port, repl_set): if ret["ok"] != 1: LOGGER.error("Failed replSetGetConfig: %s", ret) return 1 + + rs_config = ret["config"] + # We only reconfig if there is a change to 'host'. + if rs_config["members"][0]["host"] != host_port: + # With force=True, version is ignored. + # rs_config["version"] = rs_config["version"] + 1 + rs_config["members"][0]["host"] = host_port + ret = mongo.admin.command("replSetReconfig", rs_config, force=True) + if ret["ok"] != 1: + LOGGER.error("Failed replSetReconfig: %s", ret) + return 1 + LOGGER.info("Replication reconfigured: %s", ret) break + except pymongo.errors.AutoReconnect: pass except pymongo.errors.OperationFailure as err: @@ -1483,19 +1496,7 @@ def mongo_reconfig_replication(mongo, host_port, repl_set): if err.code != 94: LOGGER.error("Replication failed to initialize: %s", ret) return 1 - rs_config = ret["config"] - # We only reconfig if there is a change to 'host'. - if rs_config["members"][0]["host"] != host_port: - # With force=True, version is ignored. - # rs_config["version"] = rs_config["version"] + 1 - rs_config["members"][0]["host"] = host_port - while True: - try: - ret = mongo.admin.command("replSetReconfig", rs_config, force=True) - break - except pymongo.errors.AutoReconnect: - pass - LOGGER.info("Replication reconfigured: %s", ret) + primary_available = mongod_wait_for_primary(mongo) LOGGER.debug("isMaster: %s", mongo.admin.command("isMaster")) LOGGER.debug("replSetGetStatus: %s", mongo.admin.command("replSetGetStatus")) |