SERVER-125546 Consolidate authoritative shards feature flags into two unified flags (part 1: bulk renames) (#53401)

GitOrigin-RevId: e47c6218a2e689fee75cd0ad73b8ea9837717c93
This commit is contained in:
Joan Bruguera Micó (at MongoDB) 2026-05-08 18:34:19 +00:00 committed by MongoDB Bot
parent b801ab08e4
commit e67d85fc61
40 changed files with 143 additions and 178 deletions

View File

@ -5,8 +5,8 @@
* TODO (SERVER-98118): Remove this test.
*
* @tags: [
* featureFlagShardAuthoritativeDbMetadataCRUD,
* featureFlagShardAuthoritativeDbMetadataDDL,
* featureFlagAuthoritativeShardsCRUD,
* featureFlagAuthoritativeShardsDDL,
* ]
*/
import {FeatureFlagUtil} from "jstests/libs/feature_flag_util.js";
@ -21,12 +21,10 @@ const describeOrSkip = (() => {
const db = st.s.getDB("admin");
if (
FeatureFlagUtil.isPresentAndEnabled(db, "ShardAuthoritativeDbMetadataDDL") ||
FeatureFlagUtil.isPresentAndEnabled(db, "ShardAuthoritativeDbMetadataCRUD")
FeatureFlagUtil.isPresentAndEnabled(db, "AuthoritativeShardsDDL") ||
FeatureFlagUtil.isPresentAndEnabled(db, "AuthoritativeShardsCRUD")
) {
jsTest.log.info(
"Skipping test because ShardAuthoritativeDbMetadata feature flags are already enabled in lastLTS",
);
jsTest.log.info("Skipping test because AuthoritativeShards feature flags are already enabled in lastLTS");
return describe.skip;
}
} finally {
@ -62,13 +60,13 @@ describeOrSkip("FCV lifecycle for authoritative database metadata", function ()
const db = mongos.getDB(kDbName);
assert.eq(
enabled,
FeatureFlagUtil.isPresentAndEnabled(db, "ShardAuthoritativeDbMetadataDDL"),
`ShardAuthoritativeDbMetadataDDL flag should be ${enabled}`,
FeatureFlagUtil.isPresentAndEnabled(db, "AuthoritativeShardsDDL"),
`AuthoritativeShardsDDL flag should be ${enabled}`,
);
assert.eq(
enabled,
FeatureFlagUtil.isPresentAndEnabled(db, "ShardAuthoritativeDbMetadataCRUD"),
`ShardAuthoritativeDbMetadataCRUD flag should be ${enabled}`,
FeatureFlagUtil.isPresentAndEnabled(db, "AuthoritativeShardsCRUD"),
`AuthoritativeShardsCRUD flag should be ${enabled}`,
);
}

View File

@ -38,7 +38,7 @@ function basicCRUD(conn) {
}
function flushRoutingAndDBCacheUpdates(conn) {
if (!FeatureFlagUtil.isPresentAndEnabled(conn, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(conn, "AuthoritativeShardsCRUD")) {
assert.commandWorked(conn.adminCommand({_flushDatabaseCacheUpdates: dbName}));
assert.commandWorked(conn.adminCommand({_flushDatabaseCacheUpdates: "notRealDB"}));
}

View File

@ -15,7 +15,7 @@ const collName = "bar";
const ns = dbName + "." + collName;
function flushRoutingAndDBCacheUpdates(conn) {
if (!FeatureFlagUtil.isPresentAndEnabled(conn, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(conn, "AuthoritativeShardsCRUD")) {
assert.commandWorked(conn.adminCommand({_flushDatabaseCacheUpdates: dbName}));
assert.commandWorked(conn.adminCommand({_flushDatabaseCacheUpdates: "notRealDB"}));
}

View File

@ -1137,9 +1137,9 @@ if (FeatureFlagUtil.isPresentAndEnabled(st.s, "CheckRangeDeletionsWithMissingSha
})();
(function testFindingInconsistenciesWithDbPrimaryShardWithUnknownDbMetadata() {
if (FeatureFlagUtil.isPresentAndEnabled(st.s, "ShardAuthoritativeDbMetadataDDL")) {
if (FeatureFlagUtil.isPresentAndEnabled(st.s, "AuthoritativeShardsDDL")) {
jsTestLog(
"Skipping test since featureFlagShardAuthoritativeDbMetadataDDL is enabled and do " +
"Skipping test since featureFlagAuthoritativeShardsDDL is enabled and do " +
"not refresh database metadata.",
);
return;

View File

@ -5,7 +5,7 @@
* no inconsistencies after each DDL.
*
* @tags: [
* featureFlagShardAuthoritativeCollMetadata,
* featureFlagAuthoritativeShardsDDL,
* ]
*/

View File

@ -4,8 +4,8 @@
* collection.
*
* @tags: [
* featureFlagShardAuthoritativeDbMetadataCRUD,
* featureFlagShardAuthoritativeDbMetadataDDL,
* featureFlagAuthoritativeShardsCRUD,
* featureFlagAuthoritativeShardsDDL,
* ]
*/

View File

@ -8,8 +8,8 @@
* upgrade procedure.
*
* @tags: [
* featureFlagShardAuthoritativeDbMetadataCRUD,
* featureFlagShardAuthoritativeDbMetadataDDL,
* featureFlagAuthoritativeShardsCRUD,
* featureFlagAuthoritativeShardsDDL,
* ]
*/

View File

@ -5,8 +5,8 @@
* because the restarted node relies on the replica set config persisted to disk to know that it
* is initialized as part of a replica set and should run for election.
* @tags: [
* featureFlagShardAuthoritativeDbMetadataCRUD,
* featureFlagShardAuthoritativeDbMetadataDDL,
* featureFlagAuthoritativeShardsCRUD,
* featureFlagAuthoritativeShardsDDL,
* requires_persistence,
* ]
*/

View File

@ -2,8 +2,8 @@
* Test getDatabaseVersion command after the effects of database DDLs.
*
* @tags: [
* featureFlagShardAuthoritativeDbMetadataCRUD,
* featureFlagShardAuthoritativeDbMetadataDDL,
* featureFlagAuthoritativeShardsCRUD,
* featureFlagAuthoritativeShardsDDL,
* ]
*/

View File

@ -3,7 +3,7 @@
* shard's filtering metadata for the collection matches what the config server recorded.
*
* @tags: [
* featureFlagShardAuthoritativeCollMetadata,
* featureFlagAuthoritativeShardsDDL,
* does_not_support_stepdowns,
* ]
*/

View File

@ -3,8 +3,8 @@
* # This test is incompatible with 'config shard' as it creates a cluster with 0 shards in order
* # to be able to add shard with data on it (which is only allowed on the first shard).
* config_shard_incompatible,
* featureFlagShardAuthoritativeDbMetadataDDL,
* featureFlagShardAuthoritativeDbMetadataCRUD,
* featureFlagAuthoritativeShardsDDL,
* featureFlagAuthoritativeShardsCRUD,
* # This test restarts the server and requires that data persists across restarts.
* requires_persistence,
* ]

View File

@ -17,7 +17,7 @@ function checkTimestampConsistencyInPersistentMetadata(dbName, nss, dbTimestampI
function getDbMetadata() {
const isAuthoritativeShardEnabled = FeatureFlagUtil.isPresentAndEnabled(
st.s.getDB("admin"),
"ShardAuthoritativeDbMetadataDDL",
"AuthoritativeShardsDDL",
);
if (!isAuthoritativeShardEnabled) {
st.shard0.adminCommand({_flushDatabaseCacheUpdates: dbName, syncFromConfig: true});

View File

@ -1450,7 +1450,7 @@ const st = new ShardingTest({
// Helper function to check if authoritative database shards feature is enabled.
function isAuthoritativeShardsEnabled(conn) {
return FeatureFlagUtil.isPresentAndEnabled(conn, "ShardAuthoritativeDbMetadataCRUD");
return FeatureFlagUtil.isPresentAndEnabled(conn, "AuthoritativeShardsCRUD");
}
const doTest = (connection, testCases, commandsAddedSinceLastLTS, commandsRemovedSinceLastLTS, isMongodTest) => {

View File

@ -47,7 +47,7 @@ function assertCollectionDropped(ns, uuid = null) {
);
}
// TODO (SERVER-123313): When ShardAuthoritativeCollMetadata is enabled, the authoritative
// TODO (SERVER-123313): When AuthoritativeShardsDDL is enabled, the authoritative
// DropCollection and DropDatabase DDL commands do not clean up config.cache collection entries,
// unlike their non-authoritative counterparts. This is by design: the authoritative CRUD path
// does not use these collections, so they are expected not to exist after a drop.
@ -58,7 +58,7 @@ function assertCollectionDropped(ns, uuid = null) {
//
// Once all DDLs are fully authoritative, this escape can be removed, as config.cache
// collections will no longer be created after a drop.
const isAuthoritativeCollMetadata = FeatureFlagUtil.isPresentAndEnabled(st.s, "ShardAuthoritativeCollMetadata");
const isAuthoritativeCollMetadata = FeatureFlagUtil.isPresentAndEnabled(st.s, "AuthoritativeShardsDDL");
if (!isAuthoritativeCollMetadata) {
// Verify that persisted cached metadata was removed as part of the dropCollection
const chunksCollName = "cache.chunks." + ns;

View File

@ -14,8 +14,8 @@ import {ShardingTest} from "jstests/libs/shardingtest.js";
const st = new ShardingTest({shards: 1, config: 1});
// TODO (SERVER-124050): Investigate failure in this test when authoritative shards are enabled.
if (FeatureFlagUtil.isPresentAndEnabled(st.s, "ShardAuthoritativeCollMetadata")) {
jsTestLog("Skipping test because featureFlagShardAuthoritativeCollMetadata is enabled");
if (FeatureFlagUtil.isPresentAndEnabled(st.s, "AuthoritativeShardsCRUD")) {
jsTestLog("Skipping test because featureFlagAuthoritativeShardsCRUD is enabled");
st.stop();
quit();
}

View File

@ -211,7 +211,7 @@ export function flushRoutersAndRefreshShardMetadata(st, {ns, dbNames = []} = {},
assert.commandWorked(rs.test.getPrimary().adminCommand({_flushRoutingTableCacheUpdates: ns}));
}
if (!FeatureFlagUtil.isPresentAndEnabled(rs.test.getPrimary(), "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(rs.test.getPrimary(), "AuthoritativeShardsCRUD")) {
dbNames.forEach((dbName) => {
assert.commandWorked(rs.test.getPrimary().adminCommand({_flushDatabaseCacheUpdates: dbName}));
});

View File

@ -23,10 +23,10 @@ export function shardCollectionMoveChunks(st, kDbName, ns, shardKey, docsToInser
});
}
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard0.adminCommand({_flushDatabaseCacheUpdates: kDbName}));
}
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard1.adminCommand({_flushDatabaseCacheUpdates: kDbName}));
}

View File

@ -36,7 +36,7 @@ let sessionDB = session.getDatabase("test");
let sessionColl = sessionDB.getCollection("user");
let sessionUnsharded = sessionDB.getCollection("foo");
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "AuthoritativeShardsCRUD")) {
// Transactions do not internally retry on StaleDbVersion errors, so we ensure the primary
// shard's cached databaseVersion is fresh before running commands through mongos on the
// unsharded collections.

View File

@ -119,7 +119,7 @@ function runCommentParamTest({
// Force a refresh on the shards. This is necessary because MongoS could get StaleDbVersion
// error upon sending an agg request, causing it to retry the agg command from the top and
// resulting in more profiler entries than what is expected.
if (!FeatureFlagUtil.isPresentAndEnabled(st.rs0.getPrimary(), "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.rs0.getPrimary(), "AuthoritativeShardsCRUD")) {
assert.commandWorked(
st.rs0.getPrimary().getDB(testDB.getName()).adminCommand({
_flushDatabaseCacheUpdates: testDB.getName(),
@ -127,7 +127,7 @@ function runCommentParamTest({
}),
);
}
if (!FeatureFlagUtil.isPresentAndEnabled(st.rs1.getPrimary(), "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.rs1.getPrimary(), "AuthoritativeShardsCRUD")) {
assert.commandWorked(
st.rs1.getPrimary().getDB(testDB.getName()).adminCommand({
_flushDatabaseCacheUpdates: testDB.getName(),

View File

@ -555,10 +555,7 @@ assertAggResultAndRouting(
// TODO SERVER-98118 remove this test case.
// For the authoritative shards, the secondaries will wait internally when they are yet to
// catch up. This causes them to be always up to date.
const isAuthoritativeShardEnabled = FeatureFlagUtil.isPresentAndEnabled(
st.s.getDB("admin"),
"ShardAuthoritativeDbMetadataCRUD",
);
const isAuthoritativeShardEnabled = FeatureFlagUtil.isPresentAndEnabled(st.s.getDB("admin"), "AuthoritativeShardsCRUD");
if (!isAuthoritativeShardEnabled) {
// Test $lookup when it is routed to a secondary which is not yet aware of the foreign
// collection.

View File

@ -52,7 +52,7 @@ profilerHasNumMatchingEntriesOrThrow({
numExpectedMatches: 1,
});
if (!FeatureFlagUtil.isPresentAndEnabled(st.rs0.getPrimary(), "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.rs0.getPrimary(), "AuthoritativeShardsCRUD")) {
// Force a refresh on rs0. This is necessary because MongoS will get StaleDbVersion upon sending
// the agg request below, causing it to retry the agg command from the top and thus send
// listIndexes to the primary shard twice.

View File

@ -39,10 +39,10 @@ assert.commandWorked(db.foo.insert({"x": 50, "a": 6}));
assert.commandWorked(db.foo.insert({"x": 100, "a": 8}));
assert.commandWorked(db.foo.insert({"x": 150, "a": 20}));
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard0.adminCommand({_flushDatabaseCacheUpdates: kDbName}));
}
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard1.adminCommand({_flushDatabaseCacheUpdates: kDbName}));
}

View File

@ -64,10 +64,10 @@ function simulateResharding() {
jsTestLog("Flushing routing table updates");
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard0.adminCommand({_flushDatabaseCacheUpdates: dbName}));
}
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard1.adminCommand({_flushDatabaseCacheUpdates: dbName}));
}

View File

@ -134,7 +134,7 @@ function handleSessionsCollection(mainConn, priConn, configConn) {
// When shard authoritative collection metadata is enabled, the create coordinator commits
// metadata to the shard catalog via a retryable write (_shardsvrCommitCreateCollection
// Metadata), adding another write to config.transactions on the shard.
if (FeatureFlagUtil.isPresentAndEnabled(priConn, "ShardAuthoritativeCollMetadata")) {
if (FeatureFlagUtil.isPresentAndEnabled(priConn, "AuthoritativeShardsDDL")) {
extraCollectionWrites += 1;
}
}

View File

@ -23,7 +23,7 @@ const st = new ShardingTest({
// Helper function to check if authoritative database shards feature is enabled.
function isAuthoritativeShardsEnabled() {
return FeatureFlagUtil.isPresentAndEnabled(st.s.getDB("admin"), "ShardAuthoritativeDbMetadataCRUD");
return FeatureFlagUtil.isPresentAndEnabled(st.s.getDB("admin"), "AuthoritativeShardsCRUD");
}
enableStaleVersionAndSnapshotRetriesWithinTransactions(st);

View File

@ -243,10 +243,10 @@ let txnNumber = 0;
assert.commandWorked(st.shard0.adminCommand({_flushRoutingTableCacheUpdates: "test.user"}));
assert.commandWorked(st.shard1.adminCommand({_flushRoutingTableCacheUpdates: "test.user"}));
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard0, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard0.adminCommand({_flushDatabaseCacheUpdates: "test"}));
}
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "ShardAuthoritativeDbMetadataCRUD")) {
if (!FeatureFlagUtil.isPresentAndEnabled(st.shard1, "AuthoritativeShardsCRUD")) {
assert.commandWorked(st.shard1.adminCommand({_flushDatabaseCacheUpdates: "test"}));
}

View File

@ -802,7 +802,7 @@ private:
});
} else {
// TODO (SERVER-98118): remove once 9.0 becomes last LTS.
if (feature_flags::gShardAuthoritativeDbMetadataDDL
if (feature_flags::gAuthoritativeShardsDDL
.isEnabledOnTargetFCVButDisabledOnOriginalFCV(requestedVersion,
originalVersion)) {
// Since we have a feature flag changing value in kUpgrading, we need to drain
@ -944,9 +944,8 @@ private:
// Run the authoritative clone phase on ALL shards (including the config
// server if it's also a shard).
if (role && role->has(ClusterRole::ConfigServer)) {
if (feature_flags::gShardAuthoritativeDbMetadataDDL
.isEnabledOnTargetFCVButDisabledOnOriginalFCV(requestedVersion,
originalVersion)) {
if (feature_flags::gAuthoritativeShardsDDL.isEnabledOnTargetFCVButDisabledOnOriginalFCV(
requestedVersion, originalVersion)) {
cloneAuthoritativeDatabaseMetadataOnShards(opCtx);
}
}

View File

@ -642,8 +642,8 @@ private:
// TODO (SERVER-98118): remove once 9.0 becomes last LTS.
if (role && role->has(ClusterRole::ConfigServer) &&
feature_flags::gShardAuthoritativeDbMetadataDDL
.isEnabledOnTargetFCVButDisabledOnOriginalFCV(requestedVersion, originalVersion) &&
feature_flags::gAuthoritativeShardsDDL.isEnabledOnTargetFCVButDisabledOnOriginalFCV(
requestedVersion, originalVersion) &&
!serverGlobalParams.featureCompatibility.acquireFCVSnapshot()
.isUpgradingOrDowngrading()) {
// Drop the authoritative database collection before transitioning to kUpgrading
@ -1142,7 +1142,7 @@ private:
const bool isConfigsvr = role && role->has(ClusterRole::ConfigServer);
// TODO (SERVER-98118): remove once 9.0 becomes last LTS.
if (isConfigsvr &&
!feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabledOnVersion(requestedVersion)) {
!feature_flags::gAuthoritativeShardsDDL.isEnabledOnVersion(requestedVersion)) {
// Dropping the authoritative collections (config.shard.catalog.databases) as the final
// step of the downgrade ensures that no leftover data remains. This guarantees a clean
// downgrade and makes it safe to upgrade again.

View File

@ -113,11 +113,11 @@ public:
// get rid of this code before it hits production. The reason we take the DDL lock
// here is to respect the acquisition order DDL Lock -> FCV Lock, and avoid
// deadlocks. This is a pessimization, and thus we only do this if
// ShardAuthoritativeDbMetadataDDL is active in this binary.
// AuthoritativeShardsDDL is active in this binary.
// (Ignore FCV check): We need to know if the feature flag is active in any version.
// TODO (SERVER-102647): Remove this code.
boost::optional<DDLLockManager::ScopedBaseDDLLock> ddlLock;
if (feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabledAndIgnoreFCVUnsafe()) {
if (feature_flags::gAuthoritativeShardsDDL.isEnabledAndIgnoreFCVUnsafe()) {
ddlLock.emplace(
opCtx,
shard_role_details::getLocker(opCtx),
@ -149,8 +149,7 @@ public:
// to guarantee that all in-flight legacy commands are drained after
// transitioning to kUpgrading during FCV upgrade.
// TODO (SERVER-102647): unconditionally exit the FixedFCVRegion here
if (!feature_flags::gShardAuthoritativeDbMetadataDDL
.isEnabledAndIgnoreFCVUnsafe()) {
if (!feature_flags::gAuthoritativeShardsDDL.isEnabledAndIgnoreFCVUnsafe()) {
fixedFcvRegion.reset();
}

View File

@ -969,13 +969,13 @@ void commitCreateCollectionMetadataToShardCatalog(
AuthoritativeMetadataAccessLevelEnum getGrantedAuthoritativeMetadataAccessLevel(
const VersionContext& vCtx, const ServerGlobalParams::FCVSnapshot& snapshot) {
const bool isAuthoritativeDDLEnabled =
feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabled(vCtx, snapshot);
feature_flags::gAuthoritativeShardsDDL.isEnabled(vCtx, snapshot);
const bool isAuthoritativeCRUDEnabled =
feature_flags::gShardAuthoritativeDbMetadataCRUD.isEnabled(vCtx, snapshot);
feature_flags::gAuthoritativeShardsCRUD.isEnabled(vCtx, snapshot);
tassert(10162502,
"shardAuthoritativeDbMetadataCRUD should not be enabled if "
"shardAuthoritativeDbMetadataDDL is disabled",
"AuthoritativeShardsCRUD should not be enabled if "
"AuthoritativeShardsDDL is disabled",
isAuthoritativeDDLEnabled || !isAuthoritativeCRUDEnabled);
if (!isAuthoritativeDDLEnabled) {

View File

@ -619,7 +619,7 @@ void ShardingRecoveryService::_recoverRecoverableCriticalSections(OperationConte
}
void ShardingRecoveryService::_recoverDatabaseShardingState(OperationContext* opCtx) {
if (!feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabled(
if (!feature_flags::gAuthoritativeShardsDDL.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
return;

View File

@ -636,7 +636,7 @@ void checkCollectionMetadataInShardCatalog(
kInMemoryShardCatalogSourceScope,
inconsistencies);
if (!feature_flags::gShardAuthoritativeCollMetadata.isEnabled(
if (!feature_flags::gAuthoritativeShardsCRUD.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
return;
@ -1928,8 +1928,8 @@ std::vector<MetadataInconsistencyItem> checkDatabaseMetadataConsistency(
FixedFCVRegion fixedFcvRegion(opCtx);
if (!feature_flags::gShardAuthoritativeDbMetadataCRUD.isEnabled(
VersionContext::getDecoration(opCtx), fixedFcvRegion->acquireFCVSnapshot())) {
if (!feature_flags::gAuthoritativeShardsCRUD.isEnabled(VersionContext::getDecoration(opCtx),
fixedFcvRegion->acquireFCVSnapshot())) {
return {};
}

View File

@ -588,9 +588,9 @@ TEST_F(MetadataConsistencyTest, TimeseriesOptionsMismatchBetweenLocalAndSharding
TEST_F(MetadataConsistencyTest, FindMissingDatabaseMetadataInShardCatalogCache) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
Timestamp dbTimestamp{1, 0};
DatabaseType dbInGlobalCatalog{_dbName, _shardId, {_dbUuid, dbTimestamp}};
@ -617,9 +617,9 @@ TEST_F(MetadataConsistencyTest, FindMissingDatabaseMetadataInShardCatalogCache)
TEST_F(MetadataConsistencyTest, FindInconsistentDatabaseVersionInShardCatalogCache) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
Timestamp dbTimestamp{1, 0};
DatabaseType dbInGlobalCatalog{_dbName, kMyShardName, {_dbUuid, dbTimestamp}};
@ -647,9 +647,9 @@ TEST_F(MetadataConsistencyTest, FindInconsistentDatabaseVersionInShardCatalogCac
TEST_F(MetadataConsistencyTest, FindEmptyDurableDatabaseMetadataInShard) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
Timestamp dbTimestamp{1, 0};
DatabaseType dbInGlobalCatalog{_dbName, kMyShardName, {_dbUuid, dbTimestamp}};
@ -670,9 +670,9 @@ TEST_F(MetadataConsistencyTest, FindEmptyDurableDatabaseMetadataInShard) {
TEST_F(MetadataConsistencyTest, FindInconsistentDurableDatabaseMetadataInShardWithConfig) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
Timestamp dbTimestamp{1, 0};
DatabaseType dbInGlobalCatalog{_dbName, kMyShardName, {_dbUuid, dbTimestamp}};
@ -701,9 +701,9 @@ TEST_F(MetadataConsistencyTest, FindInconsistentDurableDatabaseMetadataInShardWi
TEST_F(MetadataConsistencyTest, FindMatchingDurableDatabaseMetadataInWrongShard) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
Timestamp dbTimestamp{1, 0};
DatabaseType dbInGlobalCatalog{_dbName, kMyShardName, {_dbUuid, dbTimestamp}};
@ -729,9 +729,9 @@ TEST_F(MetadataConsistencyTest, FindMatchingDurableDatabaseMetadataInWrongShard)
TEST_F(MetadataConsistencyTest, CheckDatabaseMetadataConsistency_CriticalSection) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
// Use the same database metadata for the global catalog and the shard catalog.
Timestamp dbTimestamp{1, 0};
@ -762,9 +762,9 @@ TEST_F(MetadataConsistencyTest, CheckDatabaseMetadataConsistency_CriticalSection
TEST_F(MetadataConsistencyTest, FindInconsistentDurableDatabaseMetadataInShard) {
RAIIServerParameterControllerForTest featureFlagControllerForDDL(
"featureFlagShardAuthoritativeDbMetadataDDL", true);
"featureFlagAuthoritativeShardsDDL", true);
RAIIServerParameterControllerForTest featureFlagControllerForCRUD(
"featureFlagShardAuthoritativeDbMetadataCRUD", true);
"featureFlagAuthoritativeShardsCRUD", true);
Timestamp dbTimestamp{1, 0};
DatabaseType dbInGlobalCatalog{_dbName, kMyShardName, {_dbUuid, dbTimestamp}};
@ -1610,8 +1610,8 @@ TEST_F(MetadataConsistencyShardCatalogTest,
TEST_F(MetadataConsistencyShardCatalogTest,
ValidateCollectionMetadata_NotOwnedChunksDisallowed_DurableAuthoritativeShardCatalogChunks) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1785,8 +1785,8 @@ TEST_F(MetadataConsistencyShardCatalogTest,
TEST_F(MetadataConsistencyShardCatalogTest,
ValidateCollectionMetadata_DurablePathGuardedByFeatureFlag) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", false);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
false);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1808,8 +1808,8 @@ TEST_F(MetadataConsistencyShardCatalogTest,
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_AllMatch) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1838,8 +1838,8 @@ TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_AllMatch) {
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_UuidMismatch) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1866,8 +1866,8 @@ TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_UuidMismatch) {
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_ShardKeyMismatch) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1897,8 +1897,8 @@ TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_ShardKeyMismatch) {
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_ChunksDomainMismatch) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1923,8 +1923,8 @@ TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_ChunksDomainMismatch) {
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_MissingCollectionInDurableCatalog) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1942,8 +1942,8 @@ TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_MissingCollectionInDurab
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_MissingChunksInDurableCatalog) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);
@ -1964,8 +1964,8 @@ TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_MissingChunksInDurableCa
}
TEST_F(MetadataConsistencyShardCatalogTest, DurablePath_SkippedWhenNonAuthoritative) {
RAIIServerParameterControllerForTest featureFlagController(
"featureFlagShardAuthoritativeCollMetadata", true);
RAIIServerParameterControllerForTest featureFlagController("featureFlagAuthoritativeShardsCRUD",
true);
const auto localUuid = setUpLocalCollection();
auto globalCatalogColl = generateCollectionType(_nss, localUuid, _keyPattern);

View File

@ -333,7 +333,7 @@ public:
auto extraInfo = status.extraInfo<StaleDbRoutingVersion>();
tassert(9980500, "StaleDbVersion must have extraInfo", extraInfo);
if (feature_flags::gShardAuthoritativeDbMetadataCRUD.isEnabled(
if (feature_flags::gAuthoritativeShardsCRUD.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
// If versionWanted exists:

View File

@ -162,7 +162,7 @@ public:
std::make_move_iterator(indexInconsistencies.end()));
}
if (feature_flags::gShardAuthoritativeDbMetadataCRUD.isEnabled(
if (feature_flags::gAuthoritativeShardsCRUD.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot()) &&
!nss.isConfigDB()) {

View File

@ -173,10 +173,10 @@ public:
"refreshed",
!dbName.isAdminDB() && !dbName.isConfigDB());
if (feature_flags::gShardAuthoritativeDbMetadataCRUD.isEnabled(
if (feature_flags::gAuthoritativeShardsCRUD.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
// When the `ShardAuthoritativeDbMetadataCRUD` feature flag is enabled, this method
// When the `AuthoritativeShardsCRUD` feature flag is enabled, this method
// should no longer be used, as nodes start relying on the `config.shard.catalog`
// authoritative collections rather than the config server (primary node) or
// contacting the primary to replicate filtering metadata in the `config.cache`

View File

@ -357,7 +357,7 @@ Status FilteringMetadataCache::onCollectionPlacementVersionMismatch(
boost::optional<ChunkVersion> chunkVersionReceived) noexcept {
try {
auto shouldUseAuthoritativePath = [&] {
if (!feature_flags::gShardAuthoritativeCollMetadata.isEnabled(
if (!feature_flags::gAuthoritativeShardsCRUD.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot()))
return false;
@ -459,7 +459,7 @@ Status FilteringMetadataCache::onDbVersionMismatch(
while (true) {
try {
auto fcvSnapshot = serverGlobalParams.featureCompatibility.acquireFCVSnapshot();
if (feature_flags::gShardAuthoritativeDbMetadataCRUD.isEnabled(
if (feature_flags::gAuthoritativeShardsCRUD.isEnabled(
VersionContext::getDecoration(opCtx), fcvSnapshot)) {
_onDbVersionMismatchAuthoritative(opCtx, dbName, clientDbVersion);
} else {

View File

@ -191,8 +191,7 @@ protected:
};
TEST_F(AuthoritativeRefreshFixture, UntrackedIsCorrectlyRecoveredFromDisk) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto untrackedNss =
@ -214,8 +213,7 @@ TEST_F(AuthoritativeRefreshFixture, UntrackedIsCorrectlyRecoveredFromDisk) {
}
TEST_F(AuthoritativeRefreshFixture, NoChunkVersionTriggersRecoveryFromDisk) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -236,8 +234,7 @@ TEST_F(AuthoritativeRefreshFixture, NoChunkVersionTriggersRecoveryFromDisk) {
}
TEST_F(AuthoritativeRefreshFixture, ChunkVersionMatchReturnsEarly) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -264,8 +261,7 @@ TEST_F(AuthoritativeRefreshFixture, ChunkVersionMatchReturnsEarly) {
TEST_F(AuthoritativeRefreshFixture,
UntrackedRouterVersionWithKnownTrackedMetadataSkipsSecondDiskRecovery) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -293,8 +289,7 @@ TEST_F(AuthoritativeRefreshFixture,
TEST_F(AuthoritativeRefreshFixture,
IgnoredReceivedVersionResolvesAfterRecoveryWithoutPostRecoveryWait) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -321,8 +316,7 @@ TEST_F(AuthoritativeRefreshFixture,
}
TEST_F(AuthoritativeRefreshFixture, HigherRouterVersionTriggersRecoveryThenConfigTimeWait) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -350,8 +344,7 @@ TEST_F(AuthoritativeRefreshFixture, HigherRouterVersionTriggersRecoveryThenConfi
}
TEST_F(AuthoritativeRefreshFixture, ConfigTimeReachedWithEmptyCSRTriggersFullRecovery) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -377,8 +370,7 @@ TEST_F(AuthoritativeRefreshFixture, ConfigTimeReachedWithEmptyCSRTriggersFullRec
}
TEST_F(AuthoritativeRefreshFixture, NonAuthoritativeTransitionDuringRecoveryReturnsEarly) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
auto dummyVersion = ChunkVersion({OID::gen(), Timestamp(50, 1)}, {1, 0});
@ -420,8 +412,7 @@ TEST_F(AuthoritativeRefreshFixture, NonAuthoritativeTransitionDuringRecoveryRetu
}
TEST_F(AuthoritativeRefreshFixture, CriticalSectionBlocksRecoveryThenProceeds) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -464,8 +455,7 @@ TEST_F(AuthoritativeRefreshFixture, CriticalSectionBlocksRecoveryThenProceeds) {
}
TEST_F(AuthoritativeRefreshFixture, RecoveryCreatesExactlyOneRecoverer) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -491,8 +481,7 @@ TEST_F(AuthoritativeRefreshFixture, RecoveryCreatesExactlyOneRecoverer) {
}
TEST_F(AuthoritativeRefreshFixture, RecovererCleanedUpAfterRecovery) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 3, kMyShardName);
@ -512,8 +501,7 @@ TEST_F(AuthoritativeRefreshFixture, RecovererCleanedUpAfterRecovery) {
}
TEST_F(AuthoritativeRefreshFixture, ThreeConcurrentCallersAllSucceed) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 10, kMyShardName);
@ -557,8 +545,7 @@ TEST_F(AuthoritativeRefreshFixture, ThreeConcurrentCallersAllSucceed) {
}
TEST_F(AuthoritativeRefreshFixture, RecoveryWithSingleChunkVerifiesExactMetadata) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 1, kMyShardName);
@ -581,8 +568,7 @@ TEST_F(AuthoritativeRefreshFixture, RecoveryWithSingleChunkVerifiesExactMetadata
}
TEST_F(AuthoritativeRefreshFixture, RecoveryWithManyChunksVerifiesVersionSorting) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 100, kMyShardName);
@ -605,8 +591,7 @@ TEST_F(AuthoritativeRefreshFixture, RecoveryWithManyChunksVerifiesVersionSorting
TEST_F(AuthoritativeRefreshFixture,
RecoveryWithChunksOnDifferentShardReportsUntrackedForThisShard) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
// All chunks belong to "otherShard", not kMyShardName.
@ -631,8 +616,7 @@ TEST_F(AuthoritativeRefreshFixture,
}
TEST_F(AuthoritativeRefreshFixture, PartialRangeDiskCatalogRecoversWithoutChunkMetadata) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const UUID uuid = UUID::gen();
@ -679,8 +663,7 @@ TEST_F(AuthoritativeRefreshFixture, PartialRangeDiskCatalogRecoversWithoutChunkM
}
TEST_F(AuthoritativeRefreshFixture, SequentialCallsAreIdempotent) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -718,8 +701,7 @@ TEST_F(AuthoritativeRefreshFixture, SequentialCallsAreIdempotent) {
}
TEST_F(AuthoritativeRefreshFixture, RecoveredVersionMatchSkipsRecoveryLoopOnNextCall) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -754,8 +736,7 @@ TEST_F(AuthoritativeRefreshFixture, RecoveredVersionMatchSkipsRecoveryLoopOnNext
}
TEST_F(AuthoritativeRefreshFixture, OngoingRecoverySatisfiesVersionSkipsDiskRecovery) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -815,8 +796,7 @@ TEST_F(AuthoritativeRefreshFixture, OngoingRecoverySatisfiesVersionSkipsDiskReco
}
TEST_F(AuthoritativeRefreshFixture, ReRecoveryAfterMetadataCleared) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -866,8 +846,7 @@ TEST_F(AuthoritativeRefreshFixture, ReRecoveryAfterMetadataCleared) {
}
TEST_F(AuthoritativeRefreshFixture, CriticalSectionExitedWithExternalMetadataSkipsDiskRecovery) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const auto [collType, chunks] = makeShardedMetadataForDisk(opCtx, 5, kMyShardName);
@ -922,8 +901,7 @@ TEST_F(AuthoritativeRefreshFixture, CriticalSectionExitedWithExternalMetadataSki
}
TEST_F(AuthoritativeRefreshFixture, UnownedRecoveryAcceptsTrackedWithNoChunksVersion) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
createTestCollection(opCtx, NamespaceString::kConfigShardCatalogCollectionsNamespace);
@ -958,8 +936,7 @@ TEST_F(AuthoritativeRefreshFixture, UnownedRecoveryAcceptsTrackedWithNoChunksVer
}
TEST_F(AuthoritativeRefreshFixture, UnownedShardVersionCheckAcceptsTrackedWithNoChunksVersion) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
createTestCollection(opCtx, NamespaceString::kConfigShardCatalogCollectionsNamespace);
@ -989,8 +966,7 @@ TEST_F(AuthoritativeRefreshFixture, UnownedShardVersionCheckAcceptsTrackedWithNo
}
TEST_F(AuthoritativeRefreshFixture, UnownedShardVersionCheckRejectsTrackedVersionWithChunks) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
createTestCollection(opCtx, NamespaceString::kConfigShardCatalogCollectionsNamespace);
@ -1015,8 +991,7 @@ TEST_F(AuthoritativeRefreshFixture, UnownedShardVersionCheckRejectsTrackedVersio
}
TEST_F(AuthoritativeRefreshFixture, TrackedCollectionWithNoChunksOnDiskRecoveredCorrectly) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
const UUID uuid = UUID::gen();
@ -1092,8 +1067,7 @@ void setDbPrimaryShardForTest(OperationContext* opCtx,
// Non-primary shard, transient primary window (set+clear) keeps the primary at `boost::none` but
// bumps the counter by two: only the counter catches the ABA. Converges to kUnowned after retry.
TEST_F(AuthoritativeRefreshFixture, TransientPrimaryAbaForcesModeBRetry) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
createTestCollection(opCtx, NamespaceString::kConfigShardCatalogCollectionsNamespace);
@ -1125,8 +1099,7 @@ TEST_F(AuthoritativeRefreshFixture, TransientPrimaryAbaForcesModeBRetry) {
// Stable DB primary baseline: no mid-flight mutation, no retry. Converges to kUntracked with
// exactly 1 Mode A + 1 Mode B recoverer.
TEST_F(AuthoritativeRefreshFixture, DbPrimaryShardInstallsUntrackedOnEmptyDisk) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
createTestCollection(opCtx, NamespaceString::kConfigShardCatalogCollectionsNamespace);
@ -1154,8 +1127,7 @@ TEST_F(AuthoritativeRefreshFixture, DbPrimaryShardInstallsUntrackedOnEmptyDisk)
// shard the new primary. Caught by the simple pre/post compare. Converges to kUntracked after
// retry.
TEST_F(AuthoritativeRefreshFixture, PrimaryChangeDuringRecoveryForcesModeBRetry) {
RAIIServerParameterControllerForTest featureFlag("featureFlagShardAuthoritativeCollMetadata",
true);
RAIIServerParameterControllerForTest featureFlag("featureFlagAuthoritativeShardsCRUD", true);
auto* opCtx = operationContext();
createTestCollection(opCtx, NamespaceString::kConfigShardCatalogCollectionsNamespace);

View File

@ -86,7 +86,7 @@ feature_flags:
Feature flag for enabling the sharding DDL coordinator for database creation.
(Enable on transitional FCV): This DDL coordinator is needed during the transition
phase of authoritative databases (featureFlagShardAuthoritativeDbMetadataDDL).
phase of authoritative databases (featureFlagAuthoritativeShardsDDL).
If this feature flag is disabled by a FCV downgrade, all instances of this DDL
coordinator are drained when finalizing the downgrade.
cpp_varname: feature_flags::gCreateDatabaseDDLCoordinator
@ -124,25 +124,25 @@ feature_flags:
version: 8.2
fcv_gated: true
# TODO (SERVER-98118): remove once 9.0 becomes last LTS.
featureFlagShardAuthoritativeDbMetadataCRUD:
featureFlagAuthoritativeShardsCRUD:
description:
"Feature flag to enable the authoritative model to read database metadata from
stored shard-local information"
cpp_varname: feature_flags::gShardAuthoritativeDbMetadataCRUD
"Feature flag to enable the authoritative model to read database and collection
metadata from stored shard-local information"
cpp_varname: feature_flags::gAuthoritativeShardsCRUD
default: false
fcv_gated: true
# TODO (SERVER-98118): remove once 9.0 becomes last LTS.
featureFlagShardAuthoritativeDbMetadataDDL:
featureFlagAuthoritativeShardsDDL:
description: >
Feature flag to enable the authoritative model to store shard-local information
for database metadata.
for database and collection metadata.
(Enable on transitional FCV): Enables cloning and writing of authoritative database
(Enable on transitional FCV): Enables cloning and writing of authoritative database and collection
metadata in shards during the transition phase, so that once the FCV is fully upgraded,
operations can start reading from it (via featureFlagShardAuthoritativeDbMetadataCRUD).
operations can start reading from it (via featureFlagAuthoritativeShardsCRUD).
If this feature flag is disabled by a FCV downgrade, all DDL coordinators checking
this flag are drained when finalizing the downgrade.
cpp_varname: feature_flags::gShardAuthoritativeDbMetadataDDL
cpp_varname: feature_flags::gAuthoritativeShardsDDL
default: false
fcv_gated: true
enable_on_transitional_fcv_UNSAFE: true

View File

@ -217,7 +217,7 @@ ExecutorFuture<void> AddShardCoordinator::_runImpl(
.then(_buildPhaseHandler(
Phase::kEnterCriticalSection,
[this, _ = shared_from_this()](auto* opCtx) {
return feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabled(
return feature_flags::gAuthoritativeShardsDDL.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot());
},
@ -316,7 +316,7 @@ ExecutorFuture<void> AddShardCoordinator::_runImpl(
.commandStatus);
}
if (feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabled(
if (feature_flags::gAuthoritativeShardsDDL.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot())) {
const auto dbs = _doc.getPreExistingDatabasesOnPromotion();
@ -359,7 +359,7 @@ ExecutorFuture<void> AddShardCoordinator::_runImpl(
.then(_buildPhaseHandler(
Phase::kExitCriticalSection,
[this, _ = shared_from_this()](auto* opCtx) {
return feature_flags::gShardAuthoritativeDbMetadataDDL.isEnabled(
return feature_flags::gAuthoritativeShardsDDL.isEnabled(
VersionContext::getDecoration(opCtx),
serverGlobalParams.featureCompatibility.acquireFCVSnapshot());
},