diff options
author | Allison Easton <allison.easton@mongodb.com> | 2022-06-02 13:07:17 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-02 13:55:49 +0000 |
commit | 3f546e227d66a5a32634fd0b072e20e7e7aaff2c (patch) | |
tree | 8bad721f01611a29df31fb0ac27be943104b150d | |
parent | 49e61af625021c8000bd980c88535b5f020fb752 (diff) | |
download | mongo-3f546e227d66a5a32634fd0b072e20e7e7aaff2c.tar.gz |
SERVER-57417 Enable NoMoreAutoSplitter Feature flag
4 files changed, 45 insertions, 7 deletions
diff --git a/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js b/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js index a50f5168cb5..31b79da65bc 100644 --- a/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js +++ b/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js @@ -17,7 +17,7 @@ load('jstests/multiVersion/libs/multi_cluster.js'); // For upgradeCluster const dbName = jsTestName(); -// TODO SERVER-57417 remove feature flag check once enabled +// TODO SERVER-65815 remove feature flag check once enabled const orphansTrackingFeatureFlagEnabled = TestData.setParameters.featureFlagOrphanTracking; //==========// @@ -53,7 +53,7 @@ function setupClusterAndDatabase(binVersion) { assert.commandWorked( st.s.adminCommand({enableSharding: dbName, primaryShard: st.shard0.shardName})); - // TODO SERVER-57417 remove feature flag check once enabled + // TODO SERVER-65815 remove feature flag check once enabled if (orphansTrackingFeatureFlagEnabled) { // TODO SERVER-64400 remove this scope once 6.0 branches out // - Shard collection (one big chunk on shard0) @@ -110,7 +110,7 @@ function checkClusterAfterBinaryUpgrade() { function checkClusterAfterFCVUpgrade(fcv) { checkConfigAndShardsFCV(fcv); - // TODO SERVER-57417 remove feature flag check once enabled + // TODO SERVER-65815 remove feature flag check once enabled if (orphansTrackingFeatureFlagEnabled) { // TODO SERVER-64400 remove this scope once 6.0 branches out // Check that orphans counter has been populated @@ -120,7 +120,7 @@ function checkClusterAfterFCVUpgrade(fcv) { } function checkClusterAfterFCVDowngrade() { - // TODO SERVER-57417 remove feature flag check once enabled + // TODO SERVER-65815 remove feature flag check once enabled if (orphansTrackingFeatureFlagEnabled) { // TODO SERVER-64400 remove this scope once 6.0 branches out // Check that orphans counter has been unset diff --git a/jstests/sharding/move_range_basic.js b/jstests/sharding/move_range_basic.js index 25cd0da3497..ac604ba4a35 100644 --- a/jstests/sharding/move_range_basic.js +++ b/jstests/sharding/move_range_basic.js @@ -2,8 +2,7 @@ * Basic tests for moveRange. * * @tags: [ - * featureFlagNoMoreAutoSplitter, - * requires_fcv_60, + * requires_fcv_61, * ] */ 'use strict'; diff --git a/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp b/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp index fe8b7813fc5..c42f7e86cd7 100644 --- a/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp +++ b/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp @@ -32,6 +32,7 @@ #include "mongo/db/s/balancer/balancer_random.h" #include "mongo/db/s/balancer/cluster_statistics_mock.h" #include "mongo/db/s/config/config_server_test_fixture.h" +#include "mongo/idl/server_parameter_test_util.h" namespace mongo { namespace { @@ -321,7 +322,26 @@ TEST_F(BalancerDefragmentationPolicyTest, TestRemoveCollectionEndsDefragmentatio ASSERT_FALSE(_defragmentationPolicy.isDefragmentingCollection(coll.getUuid())); } +TEST_F(BalancerDefragmentationPolicyTest, TestPhaseOneUserCancellationFinishesDefragmentation) { + auto coll = setupCollectionWithPhase({makeConfigChunkEntry()}); + _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); + + // Collection should be in phase 1 + verifyExpectedDefragmentationPhaseOndisk(DefragmentationPhaseEnum::kMergeAndMeasureChunks); + + // User cancellation of defragmentation + _defragmentationPolicy.abortCollectionDefragmentation(operationContext(), kNss); + + // Defragmentation should complete since the NoMoreAutoSplitter feature flag is enabled + auto nextAction = _defragmentationPolicy.getNextStreamingAction(operationContext()); + ASSERT_TRUE(nextAction == boost::none); + ASSERT_FALSE(_defragmentationPolicy.isDefragmentingCollection(coll.getUuid())); + verifyExpectedDefragmentationPhaseOndisk(boost::none); +} + TEST_F(BalancerDefragmentationPolicyTest, TestPhaseOneUserCancellationBeginsPhase3) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry()}); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); @@ -728,6 +748,8 @@ TEST_F(BalancerDefragmentationPolicyTest, */ TEST_F(BalancerDefragmentationPolicyTest, DefragmentationBeginsWithPhase3FromPersistedSetting) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); // Defragmentation does not start until startCollectionDefragmentation is called @@ -742,6 +764,8 @@ TEST_F(BalancerDefragmentationPolicyTest, DefragmentationBeginsWithPhase3FromPer } TEST_F(BalancerDefragmentationPolicyTest, SingleLargeChunkCausesAutoSplitAndSplitActions) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); auto nextAction = _defragmentationPolicy.getNextStreamingAction(operationContext()); @@ -759,6 +783,8 @@ TEST_F(BalancerDefragmentationPolicyTest, SingleLargeChunkCausesAutoSplitAndSpli } TEST_F(BalancerDefragmentationPolicyTest, CollectionMaxChunkSizeIsUsedForPhase3) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; // One chunk > 1KB should trigger AutoSplitVector auto coll = setupCollectionWithPhase( {makeConfigChunkEntry(2 * 1024)}, DefragmentationPhaseEnum::kSplitChunks, 1024); @@ -777,6 +803,8 @@ TEST_F(BalancerDefragmentationPolicyTest, CollectionMaxChunkSizeIsUsedForPhase3) } TEST_F(BalancerDefragmentationPolicyTest, TestRetryableFailedAutoSplitActionGetsReissued) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); @@ -805,6 +833,8 @@ TEST_F(BalancerDefragmentationPolicyTest, TestRetryableFailedAutoSplitActionGets TEST_F(BalancerDefragmentationPolicyTest, TestAcknowledgeAutoSplitActionTriggersSplitOnResultingRange) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); @@ -832,6 +862,8 @@ TEST_F(BalancerDefragmentationPolicyTest, } TEST_F(BalancerDefragmentationPolicyTest, TestAutoSplitWithNoSplitPointsDoesNotTriggerSplit) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); @@ -848,6 +880,8 @@ TEST_F(BalancerDefragmentationPolicyTest, TestAutoSplitWithNoSplitPointsDoesNotT } TEST_F(BalancerDefragmentationPolicyTest, TestMoreThan16MBSplitPointsTriggersSplitAndAutoSplit) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); @@ -877,6 +911,8 @@ TEST_F(BalancerDefragmentationPolicyTest, TestMoreThan16MBSplitPointsTriggersSpl } TEST_F(BalancerDefragmentationPolicyTest, TestFailedSplitChunkActionGetsReissued) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); @@ -910,6 +946,8 @@ TEST_F(BalancerDefragmentationPolicyTest, TestFailedSplitChunkActionGetsReissued TEST_F(BalancerDefragmentationPolicyTest, TestAcknowledgeLastSuccessfulSplitActionEndsDefragmentation) { + RAIIServerParameterControllerForTest featureFlagNoMoreAutoSplitterOff{ + "featureFlagNoMoreAutoSplitter", false}; auto coll = setupCollectionWithPhase({makeConfigChunkEntry(kPhase3DefaultChunkSize)}, DefragmentationPhaseEnum::kSplitChunks); _defragmentationPolicy.startCollectionDefragmentation(operationContext(), coll); diff --git a/src/mongo/s/sharding_feature_flags.idl b/src/mongo/s/sharding_feature_flags.idl index 62870218ac6..17131104e3c 100644 --- a/src/mongo/s/sharding_feature_flags.idl +++ b/src/mongo/s/sharding_feature_flags.idl @@ -35,7 +35,8 @@ feature_flags: featureFlagNoMoreAutoSplitter: description: "Guarding code for the no more auto-splitter project" cpp_varname: feature_flags::gNoMoreAutoSplitter - default: false + default: true + version: 6.1 featureFlagBalanceAccordingToDataSize: description: Balancer taking decisions based on the data size if enabled, based on number of chunks if disabled cpp_varname: feature_flags::gBalanceAccordingToDataSize |