summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2020-05-08 14:26:53 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-11 18:36:41 +0000
commit8b7d17c7d97146a3996505130ae5288269903726 (patch)
treef52aa1b06632b34401e0cb2b4d0b398c83f631fc
parentbab36adb4371436458c098186816af72309e3fb5 (diff)
downloadmongo-8b7d17c7d97146a3996505130ae5288269903726.tar.gz
SERVER-48046: {replSetFreeze: 0} done in RollbackTest.restartNode() should be resilient of network errorsr4.2.7-rc0
(cherry picked from commit f2aa1ffe05804aa3cc21ad5f980bca998dde09f3)
-rw-r--r--jstests/replsets/libs/rollback_test.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/jstests/replsets/libs/rollback_test.js b/jstests/replsets/libs/rollback_test.js
index f6c3de6f7ab..f0d47043797 100644
--- a/jstests/replsets/libs/rollback_test.js
+++ b/jstests/replsets/libs/rollback_test.js
@@ -496,8 +496,19 @@ function RollbackTest(name = "RollbackTest", replSet) {
// because we have configured the replica set with high electionTimeoutMillis.
assert.eq(newPrimary, curPrimary, "Did not elect the same node as primary");
- // Unfreeze the current secondary so that it can step up again.
- assert.commandWorked(curSecondary.adminCommand({replSetFreeze: 0}));
+ // Unfreeze the current secondary so that it can step up again. Retry on network errors
+ // in case the current secondary is in ROLLBACK state.
+ assert.soon(() => {
+ try {
+ assert.commandWorked(curSecondary.adminCommand({replSetFreeze: 0}));
+ return true;
+ } catch (e) {
+ if (isNetworkError(e)) {
+ return false;
+ }
+ throw e;
+ }
+ }, `Failed to unfreeze current secondary ${curSecondary.host}`);
}
curSecondary = rst.getSecondary();