diff options
-rw-r--r-- | jstests/replsets/libs/rollback_test.js | 15 |
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(); |