summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXueruiFa <xuerui.fa@mongodb.com>2021-06-21 17:46:57 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-21 21:51:57 +0000
commit54a3a682220f22ac4b0028582762803a99fbc598 (patch)
tree3f3da6b33f2ae66557bea9a1f78a1826b54b2788 /src
parentd515e94ed9997542091b9844e5b21a430d7d38bd (diff)
downloadmongo-54a3a682220f22ac4b0028582762803a99fbc598.tar.gz
SERVER-57214: Add option to wait for newlyAdded removal in awaitSecondaryNodes()
Diffstat (limited to 'src')
-rw-r--r--src/mongo/shell/replsettest.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 6df187b2098..223d2719141 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -719,9 +719,11 @@ var ReplSetTest = function(opts) {
/**
* Blocks until the secondary nodes have completed recovery and their roles are known. Blocks on
- * all secondary nodes or just 'secondaries', if specified.
+ * all secondary nodes or just 'secondaries', if specified. Waits for all 'newlyAdded' fields to
+ * be removed by default.
*/
- this.awaitSecondaryNodes = function(timeout, secondaries, retryIntervalMS) {
+ this.awaitSecondaryNodes = function(
+ timeout, secondaries, retryIntervalMS, waitForNewlyAddedRemoval) {
timeout = timeout || self.kDefaultTimeoutMS;
retryIntervalMS = retryIntervalMS || 200;
@@ -741,6 +743,11 @@ var ReplSetTest = function(opts) {
return ready;
}, "Awaiting secondaries", timeout, retryIntervalMS);
+
+ // We can only wait for newlyAdded field removal if test commands are enabled.
+ if (waitForNewlyAddedRemoval && jsTest.options().enableTestCommands) {
+ self.waitForAllNewlyAddedRemovals();
+ }
};
/**