summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXueruiFa <xuerui.fa@mongodb.com>2021-05-28 15:42:32 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-02 15:52:46 +0000
commit8210bff0c499fb76e6c6149b21ab33df98097d7c (patch)
treed3a3b2c48816379212755906f26c91febb791cda
parentc6ae43c162ec134c1c6ba2b768b68ff3fcba927b (diff)
downloadmongo-8210bff0c499fb76e6c6149b21ab33df98097d7c.tar.gz
SERVER-57284: Wait for config commitment in reconfig_for_psa_set_shell.js
-rw-r--r--jstests/noPassthrough/reconfig_for_psa_set_shell.js6
-rw-r--r--src/mongo/shell/replsettest.js5
2 files changed, 9 insertions, 2 deletions
diff --git a/jstests/noPassthrough/reconfig_for_psa_set_shell.js b/jstests/noPassthrough/reconfig_for_psa_set_shell.js
index 79e149d1156..3ba5460a428 100644
--- a/jstests/noPassthrough/reconfig_for_psa_set_shell.js
+++ b/jstests/noPassthrough/reconfig_for_psa_set_shell.js
@@ -8,6 +8,8 @@
(function() {
'use strict';
+load("jstests/replsets/rslib.js");
+
// Start up a PSA set with the secondary having 'votes: 0' and 'priority: 0'.
const rst = new ReplSetTest({
name: jsTestName(),
@@ -43,6 +45,9 @@ const runReconfigForPSASet = (memberIndex, config, shouldSucceed, endPriority =
if (shouldSucceed) {
assert.eq(0, result, 'expected reconfigToPSASet to succeed, but it failed');
+ // Wait for the new config to be committed.
+ assert.soonNoExcept(() => isConfigCommitted(primary));
+
const replSetGetConfig =
assert.commandWorked(primary.adminCommand({replSetGetConfig: 1})).config;
assert.eq(1, replSetGetConfig.members[1].votes);
@@ -56,6 +61,7 @@ const runReconfigForPSASet = (memberIndex, config, shouldSucceed, endPriority =
assert.eq(
0,
runMongoProgram('mongo', '--port', primary.port, '--eval', reconfigToOriginalConfig));
+ assert.soonNoExcept(() => isConfigCommitted(primary));
} else {
assert.neq(0, result, 'expected reconfigToPSASet to fail, but it succeeded');
}
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index f336f4b6b9f..b0da6f74c08 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -1213,8 +1213,9 @@ var ReplSetTest = function(opts) {
}
/**
- * Wait until the config on the primary becomes committed. Callers specify the primary in case
- * this must be called when two nodes are expected to be concurrently primary.
+ * Wait until the config on the primary becomes replicated. Callers specify the primary in case
+ * this must be called when two nodes are expected to be concurrently primary. This does not
+ * necessarily wait for the config to be committed.
*/
this.waitForConfigReplication = function(primary, nodes) {
const nodeHosts = nodes ? tojson(nodes.map((n) => n.host)) : "all nodes";