jstests/multiVersion/genericSetFCVUsage/migration_between_mixed_FCV_mixed_version_mongods.js
// we cannot move a chunk from a latestFCV + new binary shard to a downgraded binary version shard.
we cannot move a chunk from a latestFCV + new binary shard to a downgraded binary version shard.
we cannot move a chunk from a latestFCV + new binary shard to a downgraded binary version shard .
function runTest(downgradeVersion) {
    jsTestLog("Running test with downgradeVersion: " + downgradeVersion);
    let st = new ShardingTest({
        shards: [{binVersion: "latest"}, {binVersion: downgradeVersion}],
        mongos: 1,
        other: {
            mongosOptions: {binVersion: downgradeVersion},
            configOptions: {binVersion: "latest"},
        }
    });
    const featureFlagMigrationRecipientCriticalSection =
        assert.commandWorked(st.configRS.getPrimary().adminCommand(
            {getParameter: 1, featureFlagMigrationRecipientCriticalSection: 1}));
    const featureFlagMigrationRecipientCriticalSectionEnabled =
        featureFlagMigrationRecipientCriticalSection.featureFlagMigrationRecipientCriticalSection
            .value;
    if (featureFlagMigrationRecipientCriticalSectionEnabled) {
        jsTest.log('Skipping test because featureFlagMigrationRecipientCriticalSection is enabled');
        st.stop();
        return;
    }
    const downgradeFCV = binVersionToFCV(downgradeVersion);
    checkFCV(st.configRS.getPrimary().getDB("admin"), downgradeFCV);
    checkFCV(st.shard0.getDB("admin"), downgradeFCV);
    checkFCV(st.shard1.getDB("admin"), downgradeFCV);
    let testDB = st.s.getDB("test");
    assert.commandWorked(st.s.adminCommand({enableSharding: testDB.getName()}));
    st.ensurePrimaryShard(testDB.getName(), st.shard0.shardName);
    assert.commandWorked(
        st.s.adminCommand({shardCollection: testDB.coll.getFullName(), key: {a: 1}}));
    assert.commandWorked(st.shard0.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
    checkFCV(st.configRS.getPrimary().getDB("admin"), downgradeFCV);
    checkFCV(st.shard0.getDB("admin"), latestFCV);
    checkFCV(st.shard1.getDB("admin"), downgradeFCV);
    assert.commandFailedWithCode(st.s.adminCommand({
        moveChunk: testDB.coll.getFullName(),
        find: {a: 1},
        to: st.shard1.shardName,
        secondaryThrottle: true,
        writeConcern: {w: 1}
    }),
                                 ErrorCodes.IncompatibleServerVersion);
    st.stop();
}
function runTest ( downgradeVersion ) { jsTestLog ( "Running test with downgradeVersion: " + downgradeVersion ) ; let st = new ShardingTest ( { shards : [ { binVersion : "latest" } , { binVersion : downgradeVersion } ] , mongos : 1 , other : { mongosOptions : { binVersion : downgradeVersion } , configOptions : { binVersion : "latest" } , } } ) ; const featureFlagMigrationRecipientCriticalSection = assert . commandWorked ( st . configRS . getPrimary ( ) . adminCommand ( { getParameter : 1 , featureFlagMigrationRecipientCriticalSection : 1 } ) ) ; const featureFlagMigrationRecipientCriticalSectionEnabled = featureFlagMigrationRecipientCriticalSection . featureFlagMigrationRecipientCriticalSection . value ; if ( featureFlagMigrationRecipientCriticalSectionEnabled ) { jsTest . log ( 'Skipping test because featureFlagMigrationRecipientCriticalSection is enabled' ) ; st . stop ( ) ; return ; } const downgradeFCV = binVersionToFCV ( downgradeVersion ) ; checkFCV ( st . configRS . getPrimary ( ) . getDB ( "admin" ) , downgradeFCV ) ; checkFCV ( st . shard0 . getDB ( "admin" ) , downgradeFCV ) ; checkFCV ( st . shard1 . getDB ( "admin" ) , downgradeFCV ) ; let testDB = st . s . getDB ( "test" ) ; assert . commandWorked ( st . s . adminCommand ( { enableSharding : testDB . getName ( ) } ) ) ; st . ensurePrimaryShard ( testDB . getName ( ) , st . shard0 . shardName ) ; assert . commandWorked ( st . s . adminCommand ( { shardCollection : testDB . coll . getFullName ( ) , key : { a : 1 } } ) ) ; assert . commandWorked ( st . shard0 . adminCommand ( { setFeatureCompatibilityVersion : latestFCV } ) ) ; checkFCV ( st . configRS . getPrimary ( ) . getDB ( "admin" ) , downgradeFCV ) ; checkFCV ( st . shard0 . getDB ( "admin" ) , latestFCV ) ; checkFCV ( st . shard1 . getDB ( "admin" ) , downgradeFCV ) ; assert . commandFailedWithCode ( st . s . adminCommand ( { moveChunk : testDB . coll . getFullName ( ) , find : { a : 1 } , to : st . shard1 . shardName , secondaryThrottle : true , writeConcern : { w : 1 } } ) , ErrorCodes . IncompatibleServerVersion ) ; st . stop ( ) ; }
we cannot move a chunk from a latestFCV + new binary shard to a downgraded binary version shard.
we cannot move a chunk from a latestFCV + new binary shard to a downgraded binary version shard .
// SERVER-61072: Reenable this test once 6.0 becomes last LTS. // We have to skip this test because the initial state with mixed binaries and mixed FCVs // doesn't honor the upgrade/downgrade procedure and breaks with the setFCV requirements of the // new migration protocol. // Create a sharded collection with primary shard 0. // Invalid move chunk between shards with different binaries and FCVs. Pass explicit // writeConcern (which requires secondaryThrottle: true) to avoid problems if the downgraded // version doesn't automatically include writeConcern when running _recvChunkStart on the newer // shard.