diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2020-02-24 01:22:36 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-29 00:02:40 +0000 |
commit | 6c0645af5999ef52579c04f1b6fff422bd89da3c (patch) | |
tree | d8ce20701fef24f7ed9f2691e4972b792487f53e /jstests/replsets | |
parent | 2d8f351c2640f402027a2fc0c51628db8d4f85b1 (diff) | |
download | mongo-6c0645af5999ef52579c04f1b6fff422bd89da3c.tar.gz |
SERVER-46288 Reconfig in 4.2 style with the current config on FCV downgrade
- Refactoring doReplSetConfig to accept a callback.
- Use replset tag system to wait for config replication.
- Revert kConfigMajority write concern.
- Include all nodes including arbiters in config replication quorum.
- Reconfig with term -1 using the current config on downgrade.
Diffstat (limited to 'jstests/replsets')
-rw-r--r-- | jstests/replsets/awaitable_ismaster_fcv_change.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/jstests/replsets/awaitable_ismaster_fcv_change.js b/jstests/replsets/awaitable_ismaster_fcv_change.js index 872e9ff33e8..5099acf462d 100644 --- a/jstests/replsets/awaitable_ismaster_fcv_change.js +++ b/jstests/replsets/awaitable_ismaster_fcv_change.js @@ -40,7 +40,7 @@ assert(secondaryTopologyVersion.hasOwnProperty("counter"), tojson(secondaryTopol function runAwaitableIsMasterBeforeFCVChange( topologyVersionField, isUpgrade, isPrimary, prevMinWireVersion, serverMaxWireVersion) { db.getMongo().setSlaveOk(); - const firstResponse = assert.commandWorked(db.runCommand({ + let response = assert.commandWorked(db.runCommand({ isMaster: 1, topologyVersion: topologyVersionField, maxAwaitTimeMS: 99999999, @@ -48,26 +48,37 @@ function runAwaitableIsMasterBeforeFCVChange( {minWireVersion: NumberInt(0), maxWireVersion: NumberInt(serverMaxWireVersion)}, })); + // On downgrade from 4.4 to 4.2, the primary will reconfig the replset and signal isMaster. + if (prevMinWireVersion === response.minWireVersion) { + jsTestLog("Min wire version didn't change: " + prevMinWireVersion + ". Retry isMaster."); + topologyVersionField = response.topologyVersion; + response = assert.commandWorked(db.runCommand({ + isMaster: 1, + topologyVersion: topologyVersionField, + maxAwaitTimeMS: 99999999, + internalClient: + {minWireVersion: NumberInt(0), maxWireVersion: NumberInt(serverMaxWireVersion)}, + })); + } // We only expect to increment the server TopologyVersion when the minWireVersion has changed. // This can only happen in two scenarios: // 1. Setting featureCompatibilityVersion from downgrading to fullyDowngraded. // 2. Setting featureCompatibilityVersion from fullyDowngraded to upgrading. - assert.eq( - topologyVersionField.counter + 1, firstResponse.topologyVersion.counter, firstResponse); + assert.eq(topologyVersionField.counter + 1, response.topologyVersion.counter, response); const expectedIsMasterValue = isPrimary; const expectedSecondaryValue = !isPrimary; - assert.eq(expectedIsMasterValue, firstResponse.ismaster, firstResponse); - assert.eq(expectedSecondaryValue, firstResponse.secondary, firstResponse); + assert.eq(expectedIsMasterValue, response.ismaster, response); + assert.eq(expectedSecondaryValue, response.secondary, response); - const minWireVersion = firstResponse.minWireVersion; - const maxWireVersion = firstResponse.maxWireVersion; + const minWireVersion = response.minWireVersion; + const maxWireVersion = response.maxWireVersion; assert.neq(prevMinWireVersion, minWireVersion); if (isUpgrade) { // minWireVersion should always equal maxWireVersion if we have not fully downgraded FCV. - assert.eq(minWireVersion, maxWireVersion, firstResponse); + assert.eq(minWireVersion, maxWireVersion, response); } else { - assert.eq(minWireVersion + 1, maxWireVersion, firstResponse); + assert.eq(minWireVersion + 1, maxWireVersion, response); } } |