jstests/libs/sbe_util.js
/**
 * If 'theDB' corresponds to a node in a cluster, then returns true if the cluster that it
 * belongs to has at least one node that has SBE enabled and at least one node that has it
 * disabled; false otherwise.
 */
If 'theDB' corresponds to a node in a cluster, then returns true if the cluster that it
belongs to has at least one node that has SBE enabled and at least one node that has it
disabled; false otherwise.
If ' theDB ' corresponds to a node in a cluster then returns true if the cluster that it belongs to has at least one node that has SBE enabled and at least one node that has it disabled ; false otherwise .
function checkBothEnginesAreRunOnCluster(theDB) {
    let result = false;
    assert.soon(() => {
        if (!FixtureHelpers.isMongos(theDB) && !FixtureHelpers.isReplSet(theDB)) {
            return true;
        }
        let nodes;
        try {
            nodes = DiscoverTopology.findNonConfigNodes(theDB.getMongo());
        } catch (e) {
            return false;
        }
        let engineMap = {sbe: 0, classic: 0};
        for (const node of nodes) {
            try {
                const conn = new Mongo(node);
                if (FixtureHelpers.isMongos(conn.getDB("admin"))) {
                    continue;
                }
                const getParam = conn.adminCommand({
                    getParameter: 1,
                    internalQueryForceClassicEngine: 1,
                    internalQueryEnableSlotBasedExecutionEngine: 1
                });
                if (getParam.hasOwnProperty("internalQueryForceClassicEngine")) {
                    if (getParam.internalQueryForceClassicEngine) {
                        engineMap.classic++;
                    } else {
                        engineMap.sbe++;
                    }
                }
                if (getParam.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine")) {
                    if (!getParam.internalQueryEnableSlotBasedExecutionEngine) {
                        engineMap.classic++;
                    } else {
                        engineMap.sbe++;
                    }
                }
                result = (engineMap.sbe > 0 && engineMap.classic > 0);
                if (result) {
                    return true;
                }
            } catch (e) {
                continue;
            }
        }
        return true;
    });
    return result;
}
function checkBothEnginesAreRunOnCluster ( theDB ) { let result = false ; assert . soon ( ( ) => { if ( ! FixtureHelpers . isMongos ( theDB ) && ! FixtureHelpers . isReplSet ( theDB ) ) { return true ; } let nodes ; try { nodes = DiscoverTopology . findNonConfigNodes ( theDB . getMongo ( ) ) ; } catch ( e ) { return false ; } let engineMap = { sbe : 0 , classic : 0 } ; for ( const node of nodes ) { try { const conn = new Mongo ( node ) ; if ( FixtureHelpers . isMongos ( conn . getDB ( "admin" ) ) ) { continue ; } const getParam = conn . adminCommand ( { getParameter : 1 , internalQueryForceClassicEngine : 1 , internalQueryEnableSlotBasedExecutionEngine : 1 } ) ; if ( getParam . hasOwnProperty ( "internalQueryForceClassicEngine" ) ) { if ( getParam . internalQueryForceClassicEngine ) { engineMap . classic ++ ; } else { engineMap . sbe ++ ; } } if ( getParam . hasOwnProperty ( "internalQueryEnableSlotBasedExecutionEngine" ) ) { if ( ! getParam . internalQueryEnableSlotBasedExecutionEngine ) { engineMap . classic ++ ; } else { engineMap . sbe ++ ; } } result = ( engineMap . sbe > 0 && engineMap . classic > 0 ) ; if ( result ) { return true ; } } catch ( e ) { continue ; } } return true ; } ) ; return result ; }
If 'theDB' corresponds to a node in a cluster, then returns true if the cluster that it
 belongs to has at least one node that has SBE enabled and at least one node that has it
 disabled; false otherwise.
If ' theDB ' corresponds to a node in a cluster then returns true if the cluster that it belongs to has at least one node that has SBE enabled and at least one node that has it disabled ; false otherwise .
// Retry the check if we fail to discover the topology (this can happen if the test // suite has killed the primary). // If we cannot contact a node because it was killed or is otherwise unreachable, we // skip it and check the other nodes in the cluster. For our purposes, this is ok // because test suites which step down/kill certain nodes are configured to use // exactly one engine, whereas the test suites which are configured use both engines // (namely, the multiversion suites), do not step down/kill nodes. // Some versions use a different parameter to enable SBE instead of disabling it.