Files
mongo/jstests/libs/query/uwe_utils.js
Mihai Andrei 737452a9d4 SERVER-91308 Enable 'featureFlagUnifiedWriteExecutor' by default (#45731)
GitOrigin-RevId: 2ee86807228a453470e627a65fa2e8f60691ef08
2026-01-02 18:59:59 +00:00

16 lines
647 B
JavaScript

/**
* Checks whether the unified write executor is used for sharded writes.
*/
export function isUweEnabled(db) {
const UWEFlagName = "featureFlagUnifiedWriteExecutor";
// Check the value directly on mongos if the flag exists. This is necessary because we need to
// check the value on the router that we are targeting, but 'FeatureFlagUtil' will check the
// value on mongod instead.
const res = db.adminCommand({getParameter: 1, [UWEFlagName]: 1});
if (res.code === ErrorCodes.InvalidOptions) {
return false;
}
assert(res.hasOwnProperty(UWEFlagName), res);
return res[UWEFlagName].value === true;
}