diff options
Diffstat (limited to 'jstests/replsets/rollback_set_fcv.js')
-rw-r--r-- | jstests/replsets/rollback_set_fcv.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/jstests/replsets/rollback_set_fcv.js b/jstests/replsets/rollback_set_fcv.js index 7a787532e7b..a00c30f3bc0 100644 --- a/jstests/replsets/rollback_set_fcv.js +++ b/jstests/replsets/rollback_set_fcv.js @@ -21,6 +21,12 @@ function setFCV(fcv) { ErrorCodes.InterruptedDueToReplStateChange); } +// Using getParameter results in waiting for the current FCV to be majority committed. In this +// test, it never will, so we need to get the FCV directly. +function getFCVFromDocument(conn) { + return conn.getDB("admin").system.version.find().readConcern("local").toArray()[0]; +} + // fromFCV refers to the FCV we will test rolling back from. // toFCV refers to the FCV we will test rolling back to. function rollbackFCVFromDowngradingOrUpgrading(fromFCV, toFCV) { @@ -40,9 +46,8 @@ function rollbackFCVFromDowngradingOrUpgrading(fromFCV, toFCV) { // Wait for the FCV update to be reflected on the primary. This should eventually be rolled // back. assert.soon(function() { - let res = assert.commandWorked( - primary.adminCommand({getParameter: 1, featureCompatibilityVersion: 1})); - return res.featureCompatibilityVersion.hasOwnProperty('targetVersion'); + let featureCompatibilityVersion = getFCVFromDocument(primary); + return featureCompatibilityVersion.hasOwnProperty('targetVersion'); }, "Failed waiting for the server to set the targetVersion: " + fromFCV); rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); // Secondaries should never have received the FCV update. @@ -85,10 +90,9 @@ function rollbackFCVFromDowngradedOrUpgraded(fromFCV, toFCV, failPoint) { // should never make it to the secondary. hangBeforeUnsettingTargetVersion.off(); assert.soon(function() { - let res = assert.commandWorked( - primary.adminCommand({getParameter: 1, featureCompatibilityVersion: 1})); - return !res.featureCompatibilityVersion.hasOwnProperty('targetVersion') && - res.featureCompatibilityVersion.version === fromFCV; + let featureCompatibilityVersion = getFCVFromDocument(primary); + return !featureCompatibilityVersion.hasOwnProperty('targetVersion') && + featureCompatibilityVersion.version === fromFCV; }, "Failed waiting for server to unset the targetVersion or to set the FCV to " + fromFCV); rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); // The secondary should never have received the update to unset the targetVersion. @@ -125,4 +129,4 @@ rollbackFCVFromDowngradedOrUpgraded(lastStableFCV, latestFCV, "hangWhileDowngrad rollbackFCVFromDowngradedOrUpgraded(latestFCV, lastStableFCV, "hangWhileUpgrading"); rollbackTest.stop(); -}());
\ No newline at end of file +}()); |