summaryrefslogtreecommitdiff
path: root/pytests
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2018-06-26 18:26:41 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2018-06-27 13:14:33 -0400
commit0fdc2e40994c930a97aa213fa990423616bc5268 (patch)
treed90a5e3b66f8b2341d42956585ae82f034e92605 /pytests
parent5b2c9e50e17d8bbba23986d4cf7ca649861f4510 (diff)
downloadmongo-0fdc2e40994c930a97aa213fa990423616bc5268.tar.gz
SERVER-35588 powertest.py should call replSetReconfigure command only after successful replSetGetConfig
Diffstat (limited to 'pytests')
-rwxr-xr-xpytests/powertest.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/pytests/powertest.py b/pytests/powertest.py
index 477a5f460b5..b05ad1d2415 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"))