diff options
author | Tommaso Tocci <tommaso.tocci@mongodb.com> | 2021-12-17 18:55:55 +0100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-13 11:09:00 +0000 |
commit | 546d77f0945fabc0fc485e762bd7548871ffc601 (patch) | |
tree | 1f97ea98116fa586f243ee8329ee31886d028ff2 | |
parent | 2739eb4ecd1cf45cb49df48b03e958444c471358 (diff) | |
download | mongo-546d77f0945fabc0fc485e762bd7548871ffc601.tar.gz |
SERVER-61558 Rename configureCollectionAutosplitter commandr5.3.0-alpha0
20 files changed, 138 insertions, 107 deletions
diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index 5d852cd54a6..943e83d1115 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -90,7 +90,10 @@ let viewsCommandTests = { _configsvrCommitMovePrimary: {skip: isAnInternalCommand}, // Can be removed once 6.0 is last LTS _configsvrCommitReshardCollection: {skip: isAnInternalCommand}, - _configsvrConfigureAutoSplit: {skip: isAnInternalCommand}, + _configsvrConfigureAutoSplit: { + skip: isAnInternalCommand + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + _configsvrConfigureCollectionBalancing: {skip: isAnInternalCommand}, _configsvrCreateDatabase: {skip: isAnInternalCommand}, _configsvrDropCollection: {skip: isAnInternalCommand}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS @@ -220,7 +223,10 @@ let viewsCommandTests = { commitTransaction: {skip: isUnrelated}, compact: {command: {compact: "view", force: true}, expectFailure: true, skipSharded: true}, configureFailPoint: {skip: isUnrelated}, - configureCollectionAutoSplitter: {skip: isUnrelated}, + configureCollectionAutoSplitter: { + skip: isUnrelated + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + configureCollectionBalancing: {skip: isUnrelated}, connPoolStats: {skip: isUnrelated}, connPoolSync: {skip: isUnrelated}, connectionStatus: {skip: isUnrelated}, diff --git a/jstests/replsets/db_reads_while_recovering_all_commands.js b/jstests/replsets/db_reads_while_recovering_all_commands.js index f7673b9c03d..cc929dd1bbc 100644 --- a/jstests/replsets/db_reads_while_recovering_all_commands.js +++ b/jstests/replsets/db_reads_while_recovering_all_commands.js @@ -38,7 +38,7 @@ const allCommands = { _configsvrCommitChunkMigration: {skip: isPrimaryOnly}, _configsvrCommitChunkSplit: {skip: isPrimaryOnly}, _configsvrCommitReshardCollection: {skip: isPrimaryOnly}, - _configsvrConfigureAutoSplit: {skip: isPrimaryOnly}, + _configsvrConfigureCollectionBalancing: {skip: isPrimaryOnly}, _configsvrCreateDatabase: {skip: isPrimaryOnly}, _configsvrEnsureChunkVersionIsGreaterThan: {skip: isPrimaryOnly}, _configsvrMoveChunk: {skip: isPrimaryOnly}, @@ -122,7 +122,7 @@ const allCommands = { commitTransaction: {skip: isPrimaryOnly}, compact: {skip: isNotAUserDataRead}, configureFailPoint: {skip: isNotAUserDataRead}, - configureCollectionAutoSplitter: {skip: isPrimaryOnly}, + configureCollectionBalancing: {skip: isPrimaryOnly}, connPoolStats: {skip: isNotAUserDataRead}, connPoolSync: {skip: isNotAUserDataRead}, connectionStatus: {skip: isNotAUserDataRead}, diff --git a/jstests/sharding/autosplit_configure_collection.js b/jstests/sharding/autosplit_configure_collection.js index 0c31fdfb830..c1658add12f 100644 --- a/jstests/sharding/autosplit_configure_collection.js +++ b/jstests/sharding/autosplit_configure_collection.js @@ -3,8 +3,8 @@ * due to data insertion. * * @tags: [ - * requires_fcv_51, - * featureFlagPerCollectionAutoSplitter, + * requires_fcv_53, + * featureFlagPerCollBalancingSettings, * ] */ (function() { @@ -52,10 +52,10 @@ function insertDocsAndWaitForSplit(numDocs) { let configDB = db.getSiblingDB('config'); -jsTest.log("Testing enableAutoSplitter == false, defaultChunkSize=unset ..."); +jsTest.log("Testing enableAutoSplitter == false, chunkSize=unset ..."); { assert.commandWorked( - st.s0.adminCommand({configureCollectionAutoSplitter: fullNS, enableAutoSplitter: false})); + st.s0.adminCommand({configureCollectionBalancing: fullNS, enableAutoSplitter: false})); let configColl = configDB.collections.findOne({_id: fullNS}); @@ -71,10 +71,10 @@ jsTest.log("Testing enableAutoSplitter == false, defaultChunkSize=unset ..."); findChunksUtil.countChunksForNs(st.config, fullNS), 1, "Number of chunks is more than one"); } -jsTest.log("Testing enableAutoSplitter == true, defaultChunkSize=unset ..."); +jsTest.log("Testing enableAutoSplitter == true, chunkSize=unset ..."); { assert.commandWorked( - st.s0.adminCommand({configureCollectionAutoSplitter: fullNS, enableAutoSplitter: true})); + st.s0.adminCommand({configureCollectionBalancing: fullNS, enableAutoSplitter: true})); let configColl = configDB.collections.findOne({_id: fullNS}); @@ -90,10 +90,10 @@ jsTest.log("Testing enableAutoSplitter == true, defaultChunkSize=unset ..."); findChunksUtil.countChunksForNs(st.config, fullNS), 1, "Number of chunks is more than one"); } -jsTest.log("Testing enableAutoSplitter == false, defaultChunkSize=1 ..."); +jsTest.log("Testing enableAutoSplitter == false, chunkSize=1 ..."); { assert.commandWorked(st.s0.adminCommand( - {configureCollectionAutoSplitter: fullNS, enableAutoSplitter: false, defaultChunkSize: 1})); + {configureCollectionBalancing: fullNS, enableAutoSplitter: false, chunkSize: 1})); let configColl = configDB.collections.findOne({_id: fullNS}); @@ -111,10 +111,10 @@ jsTest.log("Testing enableAutoSplitter == false, defaultChunkSize=1 ..."); findChunksUtil.countChunksForNs(st.config, fullNS), 1, "Number of chunks is more than one"); } -jsTest.log("Testing enableAutoSplitter == true, defaultChunkSize=10 ..."); +jsTest.log("Testing enableAutoSplitter == true, chunkSize=10 ..."); { assert.commandWorked(st.s0.adminCommand( - {configureCollectionAutoSplitter: fullNS, enableAutoSplitter: true, defaultChunkSize: 10})); + {configureCollectionBalancing: fullNS, enableAutoSplitter: true, chunkSize: 10})); let configColl = configDB.collections.findOne({_id: fullNS}); diff --git a/jstests/sharding/balancer_defragmentation_merge_chunks.js b/jstests/sharding/balancer_defragmentation_merge_chunks.js index 66ef4d4e992..d7c3786a4c1 100644 --- a/jstests/sharding/balancer_defragmentation_merge_chunks.js +++ b/jstests/sharding/balancer_defragmentation_merge_chunks.js @@ -1,9 +1,9 @@ /** - * Test the setCollectionAutosplitter command and balancerCollectionStatus command + * Test the configureCollectionBalancing command and balancerCollectionStatus command * * @tags: [ - * requires_fcv_51, - * featureFlagPerCollectionAutoSplitter, + * requires_fcv_53, + * featureFlagPerCollBalancingSettings, * ] */ @@ -43,7 +43,7 @@ st.forEachConfigServer((conn) => { }); }); -const defaultChunkSize = 2; +const chunkSize = 2; const bigString = "X".repeat(32 * 1024); // 32 KB function waitForBalanced(ns) { @@ -64,9 +64,9 @@ function setupCollection() { // "startBalancer" only guarantee that all the shards will EVENTUALLY enable the autosplitter. // In order to ensure that all the shards have ALREADY enabled the autosplitter, we use the - // configureCollectionAutoSplitter command instead. + // configureCollectionBalancing command instead. assert.commandWorked( - st.s.adminCommand({configureCollectionAutoSplitter: fullNs, enableAutoSplitter: true})); + st.s.adminCommand({configureCollectionBalancing: fullNs, enableAutoSplitter: true})); for (let i = 0; i < 250; i++) { assert.commandWorked(coll.insert({key: Random.randInt(1000) - 500, str: bigString})); @@ -110,19 +110,19 @@ jsTest.log("Begin and end defragmentation with balancer off."); { st.stopBalancer(); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll1, + configureCollectionBalancing: coll1, enableAutoSplitter: false, balancerShouldMergeChunks: true, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); let beforeStatus = assert.commandWorked(st.s.adminCommand({balancerCollectionStatus: coll1})); assert.eq(beforeStatus.balancerCompliant, false); assert.eq(beforeStatus.firstComplianceViolation, 'chunksMerging'); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll1, + configureCollectionBalancing: coll1, enableAutoSplitter: false, balancerShouldMergeChunks: false, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); let afterStatus = assert.commandWorked(st.s.adminCommand({balancerCollectionStatus: coll1})); assert.eq(afterStatus.balancerCompliant, true); @@ -134,20 +134,20 @@ jsTest.log("Begin and end defragmentation with balancer on"); // Allow the first phase transition to build the initial defragmentation state setFailPointOnConfigNodes("beforeTransitioningDefragmentationPhase", {skip: 1}); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll1, + configureCollectionBalancing: coll1, enableAutoSplitter: false, balancerShouldMergeChunks: true, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); st.awaitBalancerRound(); let beforeStatus = assert.commandWorked(st.s.adminCommand({balancerCollectionStatus: coll1})); assert.eq(beforeStatus.balancerCompliant, false); assert.eq(beforeStatus.firstComplianceViolation, 'chunksMerging'); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll1, + configureCollectionBalancing: coll1, enableAutoSplitter: false, balancerShouldMergeChunks: false, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); setFailPointOnConfigNodes("beforeTransitioningDefragmentationPhase", "off"); st.awaitBalancerRound(); @@ -162,10 +162,10 @@ jsTest.log("Begin defragmentation with balancer off, end with it on"); // Allow the first phase transition to build the initial defragmentation state setFailPointOnConfigNodes("beforeTransitioningDefragmentationPhase", {skip: 1}); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll2, + configureCollectionBalancing: coll2, enableAutoSplitter: false, balancerShouldMergeChunks: true, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); st.startBalancer(); st.awaitBalancerRound(); @@ -173,10 +173,10 @@ jsTest.log("Begin defragmentation with balancer off, end with it on"); assert.eq(beforeStatus.balancerCompliant, false); assert.eq(beforeStatus.firstComplianceViolation, 'chunksMerging'); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll2, + configureCollectionBalancing: coll2, enableAutoSplitter: false, balancerShouldMergeChunks: false, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); setFailPointOnConfigNodes("beforeTransitioningDefragmentationPhase", "off"); st.awaitBalancerRound(); @@ -193,10 +193,10 @@ jsTest.log("Balancer on, begin defragmentation and let it complete"); // Pause after phase 1 completes to check merging succeeded setFailPointOnConfigNodes("beforeTransitioningDefragmentationPhase", {skip: 1}); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll3, + configureCollectionBalancing: coll3, enableAutoSplitter: false, balancerShouldMergeChunks: true, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); st.startBalancer(); // Wait for phase 1 to complete @@ -231,10 +231,10 @@ jsTest.log("Changed uuid causes defragmentation to restart"); // Pause defragmentation after initialization but before phase 1 runs setFailPointOnConfigNodes("afterBuildingNextDefragmentationPhase", "alwaysOn"); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll4, + configureCollectionBalancing: coll4, enableAutoSplitter: false, balancerShouldMergeChunks: true, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); st.startBalancer(); // Reshard collection @@ -270,10 +270,10 @@ jsTest.log("Refined shard key causes defragmentation to restart"); // Pause defragmentation after initialization but before phase 1 runs setFailPointOnConfigNodes("afterBuildingNextDefragmentationPhase", "alwaysOn"); assert.commandWorked(st.s.adminCommand({ - configureCollectionAutoSplitter: coll5, + configureCollectionBalancing: coll5, enableAutoSplitter: false, balancerShouldMergeChunks: true, - defaultChunkSize: defaultChunkSize, + chunkSize: chunkSize, })); st.startBalancer(); // Refine shard key - shouldn't change uuid diff --git a/jstests/sharding/database_versioning_all_commands.js b/jstests/sharding/database_versioning_all_commands.js index 0047dae628b..1cc492ae7bc 100644 --- a/jstests/sharding/database_versioning_all_commands.js +++ b/jstests/sharding/database_versioning_all_commands.js @@ -299,7 +299,7 @@ let testCases = { commitReshardCollection: {skip: "always targets the config server"}, commitTransaction: {skip: "unversioned and uses special targetting rules"}, compact: {skip: "not allowed through mongos"}, - configureCollectionAutoSplitter: {skip: "always targets the config server"}, + configureCollectionBalancing: {skip: "always targets the config server"}, configureFailPoint: {skip: "executes locally on mongos (not sent to any remote node)"}, connPoolStats: {skip: "executes locally on mongos (not sent to any remote node)"}, connPoolSync: {skip: "executes locally on mongos (not sent to any remote node)"}, diff --git a/jstests/sharding/libs/last_lts_mongos_commands.js b/jstests/sharding/libs/last_lts_mongos_commands.js index 8938adfa381..8b82192728b 100644 --- a/jstests/sharding/libs/last_lts_mongos_commands.js +++ b/jstests/sharding/libs/last_lts_mongos_commands.js @@ -5,6 +5,8 @@ // test defined without always existing on the servers being used. const commandsRemovedFromMongosSinceLastLTS = [ "repairShardedCollectionChunksHistory", + "configureCollectionAutoSplitter", // TODO SERVER-62374: remove this once 5.3 becomes + // last-continuos ]; // These commands were added in mongos since the last LTS version, so will not appear in the // listCommands output of a last LTS version mongos. We will allow these commands to have a test @@ -13,7 +15,7 @@ const commandsAddedToMongosSinceLastLTS = [ "abortReshardCollection", "cleanupReshardCollection", "commitReshardCollection", - "configureCollectionAutoSplitter", + "configureCollectionBalancing", "reshardCollection", "rotateCertificates", "setAllowMigrations", diff --git a/jstests/sharding/read_write_concern_defaults_application.js b/jstests/sharding/read_write_concern_defaults_application.js index f41f5662ef5..1a066f1e265 100644 --- a/jstests/sharding/read_write_concern_defaults_application.js +++ b/jstests/sharding/read_write_concern_defaults_application.js @@ -93,7 +93,10 @@ let testCases = { _configsvrCommitChunkSplit: {skip: "internal command"}, _configsvrCommitMovePrimary: {skip: "internal command"}, // Can be removed once 6.0 is last LTS _configsvrCommitReshardCollection: {skip: "internal command"}, - _configsvrConfigureAutoSplit: {skip: "internal command"}, + _configsvrConfigureAutoSplit: { + skip: "internal command" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + _configsvrConfigureCollectionBalancing: {skip: "internal command"}, _configsvrCreateDatabase: {skip: "internal command"}, _configsvrDropCollection: {skip: "internal command"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS @@ -266,7 +269,10 @@ let testCases = { useLogs: true, }, compact: {skip: "does not accept read or write concern"}, - configureCollectionAutoSplitter: {skip: "does not accept read or write concern"}, + configureCollectionAutoSplitter: { + skip: "does not accept read or write concern" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + configureCollectionBalancing: {skip: "does not accept read or write concern"}, configureFailPoint: {skip: "does not accept read or write concern"}, connPoolStats: {skip: "does not accept read or write concern"}, connPoolSync: {skip: "internal command"}, diff --git a/jstests/sharding/safe_secondary_reads_drop_recreate.js b/jstests/sharding/safe_secondary_reads_drop_recreate.js index 5c33d3d82f3..58b5fc2b106 100644 --- a/jstests/sharding/safe_secondary_reads_drop_recreate.js +++ b/jstests/sharding/safe_secondary_reads_drop_recreate.js @@ -55,7 +55,10 @@ let testCases = { _configsvrCommitChunkSplit: {skip: "primary only"}, _configsvrCommitMovePrimary: {skip: "primary only"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS - _configsvrConfigureAutoSplit: {skip: "primary only"}, + _configsvrConfigureAutoSplit: { + skip: "primary only" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + _configsvrConfigureCollectionBalancing: {skip: "primary only"}, _configsvrDropCollection: {skip: "primary only"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS _configsvrDropDatabase: @@ -123,7 +126,10 @@ let testCases = { commitReshardCollection: {skip: "primary only"}, commitTransaction: {skip: "primary only"}, compact: {skip: "does not return user data"}, - configureCollectionAutoSplitter: {skip: "does not return user data"}, + configureCollectionAutoSplitter: { + skip: "does not return user data" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + configureCollectionBalancing: {skip: "does not return user data"}, configureFailPoint: {skip: "does not return user data"}, connPoolStats: {skip: "does not return user data"}, connPoolSync: {skip: "does not return user data"}, diff --git a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js index 594cb005ddd..fa6b2f2e7d9 100644 --- a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js +++ b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js @@ -60,7 +60,10 @@ let testCases = { _configsvrCommitChunkSplit: {skip: "primary only"}, _configsvrCommitMovePrimary: {skip: "primary only"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS - _configsvrConfigureAutoSplit: {skip: "primary only"}, + _configsvrConfigureAutoSplit: { + skip: "primary only" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + _configsvrConfigureCollectionBalancing: {skip: "primary only"}, _configsvrDropCollection: {skip: "primary only"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS _configsvrDropDatabase: @@ -134,7 +137,10 @@ let testCases = { cloneCollectionAsCapped: {skip: "primary only"}, commitReshardCollection: {skip: "primary only"}, commitTransaction: {skip: "primary only"}, - configureCollectionAutoSplitter: {skip: "does not return user data"}, + configureCollectionAutoSplitter: { + skip: "does not return user data" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + configureCollectionBalancing: {skip: "does not return user data"}, collMod: {skip: "primary only"}, collStats: {skip: "does not return user data"}, compact: {skip: "does not return user data"}, diff --git a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js index 4f9d475539f..4921cce3bc8 100644 --- a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js +++ b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js @@ -52,7 +52,10 @@ let testCases = { _configsvrCommitChunkSplit: {skip: "primary only"}, _configsvrCommitMovePrimary: {skip: "primary only"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS - _configsvrConfigureAutoSplit: {skip: "primary only"}, + _configureCollectionAutoSplitter: { + skip: "primary only" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + _configsvrConfigureCollectionBalancing: {skip: "primary only"}, _configsvrDropCollection: {skip: "primary only"}, // TODO SERVER-58843: Remove once 6.0 becomes last LTS _configsvrDropDatabase: @@ -124,7 +127,10 @@ let testCases = { commitReshardCollection: {skip: "primary only"}, commitTransaction: {skip: "primary only"}, compact: {skip: "does not return user data"}, - configureCollectionAutoSplitter: {skip: "does not return user data"}, + configureCollectionAutoSplitter: { + skip: "does not return user data" + }, // TODO SERVER-62374: remove this once 5.3 becomes last continuos release + configureCollectionBalancing: {skip: "does not return user data"}, configureFailPoint: {skip: "does not return user data"}, connPoolStats: {skip: "does not return user data"}, connPoolSync: {skip: "does not return user data"}, diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript index ebf08d00653..9547a5bf866 100644 --- a/src/mongo/db/s/SConscript +++ b/src/mongo/db/s/SConscript @@ -299,7 +299,7 @@ env.Library( 'config/configsvr_clear_jumbo_flag_command.cpp', 'config/configsvr_commit_chunk_migration_command.cpp', 'config/configsvr_commit_reshard_collection_command.cpp', - 'config/configsvr_configure_collection_auto_split.cpp', + 'config/configsvr_configure_collection_balancing.cpp', 'config/configsvr_control_balancer_command.cpp', 'config/configsvr_create_database_command.cpp', 'config/configsvr_ensure_chunk_version_is_greater_than_command.cpp', diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index 13b05118f31..0dd70a8e39a 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -59,7 +59,7 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" #include "mongo/s/request_types/balancer_collection_status_gen.h" -#include "mongo/s/request_types/configure_collection_auto_split_gen.h" +#include "mongo/s/request_types/configure_collection_balancing_gen.h" #include "mongo/s/shard_util.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/exit.h" diff --git a/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp b/src/mongo/db/s/config/configsvr_configure_collection_balancing.cpp index b6ad5c4fe01..ca657e71053 100644 --- a/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp +++ b/src/mongo/db/s/config/configsvr_configure_collection_balancing.cpp @@ -44,16 +44,16 @@ #include "mongo/db/s/shard_filtering_metadata_refresh.h" #include "mongo/s/balancer_configuration.h" #include "mongo/s/grid.h" -#include "mongo/s/request_types/configure_collection_auto_split_gen.h" +#include "mongo/s/request_types/configure_collection_balancing_gen.h" #include "mongo/s/write_ops/batched_command_request.h" namespace mongo { namespace { -class ConfigsvrConfigureAutoSplitCommand final - : public TypedCommand<ConfigsvrConfigureAutoSplitCommand> { +class ConfigsvrConfigureCollectionBalancingCmd final + : public TypedCommand<ConfigsvrConfigureCollectionBalancingCmd> { public: - using Request = ConfigsvrConfigureCollAutoSplit; + using Request = ConfigsvrConfigureCollectionBalancing; class Invocation final : public InvocationBase { public: @@ -65,8 +65,8 @@ public: serverGlobalParams.clusterRole == ClusterRole::ConfigServer); uassert(8423309, - "_configsvrConfigureAutoSplit command not supported", - mongo::feature_flags::gShardingPerCollectionAutoSplitter.isEnabled( + str::stream() << Request::kCommandName << " command not supported", + mongo::feature_flags::gPerCollBalancingSettings.isEnabled( serverGlobalParams.featureCompatibility)); const NamespaceString& nss = ns(); @@ -75,18 +75,18 @@ public: str::stream() << "Invalid namespace specified '" << nss.ns() << "'", nss.isValid()); - const auto maxChunkSizeBytes = [&]() -> boost::optional<int64_t> { - if (request().getDefaultChunkSizeMB()) { - return *request().getDefaultChunkSizeMB() * 1024 * 1024; + const auto chunkSizeBytes = [&]() -> boost::optional<int64_t> { + if (request().getChunkSizeMB()) { + return *request().getChunkSizeMB() * 1024 * 1024; } return boost::none; }(); // throws if collection does not exist or parameters are invalid - ShardingCatalogManager::get(opCtx)->configureCollectionAutoSplit( + ShardingCatalogManager::get(opCtx)->configureCollectionBalancing( opCtx, nss, - maxChunkSizeBytes, + chunkSizeBytes, request().getBalancerShouldMergeChunks(), request().getEnableAutoSplitter()); } @@ -127,7 +127,7 @@ public: return AllowedOnSecondary::kNever; } -} configsvrConfigureAutoSplitCmd; +} configsvrConfigureCollectionBalancingCmd; } // namespace } // namespace mongo diff --git a/src/mongo/db/s/config/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h index 870537a4fa8..954167be2d8 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager.h +++ b/src/mongo/db/s/config/sharding_catalog_manager.h @@ -413,9 +413,9 @@ public: TxnNumber txnNumber); - void configureCollectionAutoSplit(OperationContext* opCtx, + void configureCollectionBalancing(OperationContext* opCtx, const NamespaceString& nss, - boost::optional<int64_t> maxChunkSizeBytes, + boost::optional<int64_t> chunkSizeBytes, boost::optional<bool> balancerShouldMergeChunks, boost::optional<bool> enableAutoSplitter); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp index 2851b944304..85d3a27fcb5 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp @@ -549,10 +549,10 @@ void ShardingCatalogManager::updateShardingCatalogEntryForCollectionInTxn( } -void ShardingCatalogManager::configureCollectionAutoSplit( +void ShardingCatalogManager::configureCollectionBalancing( OperationContext* opCtx, const NamespaceString& nss, - boost::optional<int64_t> maxChunkSizeBytes, + boost::optional<int64_t> chunkSizeBytes, boost::optional<bool> balancerShouldMergeChunks, boost::optional<bool> enableAutoSplitter) { @@ -566,22 +566,22 @@ void ShardingCatalogManager::configureCollectionAutoSplit( uassert(ErrorCodes::InvalidOptions, "invalid collection auto splitter config update", - maxChunkSizeBytes || balancerShouldMergeChunks || enableAutoSplitter); + chunkSizeBytes || balancerShouldMergeChunks || enableAutoSplitter); short updatedFields = 0; bool doMerge, doSplit = false; BSONObjBuilder updateCmd; { BSONObjBuilder setBuilder(updateCmd.subobjStart("$set")); - if (maxChunkSizeBytes && *maxChunkSizeBytes != 0) { + if (chunkSizeBytes && *chunkSizeBytes != 0) { // verify we got a positive integer in range [1MB, 1GB] uassert(ErrorCodes::InvalidOptions, - str::stream() << "Chunk size '" << *maxChunkSizeBytes + str::stream() << "Chunk size '" << *chunkSizeBytes << "' out of range [1MB, 1GB]", - *maxChunkSizeBytes > 0 && - ChunkSizeSettingsType::checkMaxChunkSizeValid(*maxChunkSizeBytes)); + *chunkSizeBytes > 0 && + ChunkSizeSettingsType::checkMaxChunkSizeValid(*chunkSizeBytes)); - setBuilder.append(CollectionType::kMaxChunkSizeBytesFieldName, *maxChunkSizeBytes); + setBuilder.append(CollectionType::kMaxChunkSizeBytesFieldName, *chunkSizeBytes); updatedFields++; } if (balancerShouldMergeChunks) { @@ -595,7 +595,7 @@ void ShardingCatalogManager::configureCollectionAutoSplit( updatedFields++; } } - if (maxChunkSizeBytes && *maxChunkSizeBytes == 0) { + if (chunkSizeBytes && *chunkSizeBytes == 0) { BSONObjBuilder unsetBuilder(updateCmd.subobjStart("$unset")); unsetBuilder.append(CollectionType::kMaxChunkSizeBytesFieldName, 0); updatedFields++; diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript index 66ab7a5fd6d..af91ffcba89 100644 --- a/src/mongo/s/SConscript +++ b/src/mongo/s/SConscript @@ -191,7 +191,7 @@ env.Library( 'request_types/clone_collection_options_from_primary_shard.idl', 'request_types/commit_chunk_migration_request_type.cpp', 'request_types/commit_reshard_collection.idl', - 'request_types/configure_collection_auto_split.idl', + 'request_types/configure_collection_balancing.idl', 'request_types/drop_collection_if_uuid_not_matching.idl', 'request_types/ensure_chunk_version_is_greater_than.idl', 'request_types/flush_database_cache_updates.idl', diff --git a/src/mongo/s/commands/SConscript b/src/mongo/s/commands/SConscript index c1ff6231b98..cc9c85d7601 100644 --- a/src/mongo/s/commands/SConscript +++ b/src/mongo/s/commands/SConscript @@ -156,7 +156,7 @@ env.Library( 'cluster_add_shard_to_zone_cmd.cpp', 'cluster_balancer_collection_status_cmd.cpp', 'cluster_clear_jumbo_flag_cmd.cpp', - 'cluster_configure_collection_auto_split.cpp', + 'cluster_configure_collection_balancing.cpp', 'cluster_control_balancer_cmd.cpp', 'cluster_list_shards_cmd.cpp', 'cluster_merge_chunks_cmd.cpp', diff --git a/src/mongo/s/commands/cluster_configure_collection_auto_split.cpp b/src/mongo/s/commands/cluster_configure_collection_balancing.cpp index b2e06df45e1..0a95d50364e 100644 --- a/src/mongo/s/commands/cluster_configure_collection_auto_split.cpp +++ b/src/mongo/s/commands/cluster_configure_collection_balancing.cpp @@ -43,14 +43,14 @@ #include "mongo/idl/idl_parser.h" #include "mongo/s/catalog_cache_loader.h" #include "mongo/s/grid.h" -#include "mongo/s/request_types/configure_collection_auto_split_gen.h" +#include "mongo/s/request_types/configure_collection_balancing_gen.h" namespace mongo { namespace { -class ConfigCollAutoSplitCmd final : public TypedCommand<ConfigCollAutoSplitCmd> { +class ConfigCollectionBalancingCmd final : public TypedCommand<ConfigCollectionBalancingCmd> { public: - using Request = ConfigureCollAutoSplit; + using Request = ConfigureCollectionBalancing; class Invocation final : public InvocationBase { public: @@ -62,8 +62,8 @@ public: opCtx->setAlwaysInterruptAtStepDownOrUp(); const NamespaceString& nss = ns(); - ConfigsvrConfigureCollAutoSplit configsvrRequest(nss); - configsvrRequest.setConfigureCollAutoSplit(request().getConfigureCollAutoSplit()); + ConfigsvrConfigureCollectionBalancing configsvrRequest(nss); + configsvrRequest.setCollBalancingParams(request().getCollBalancingParams()); configsvrRequest.setDbName(request().getDbName()); auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard(); @@ -113,7 +113,7 @@ public: return AllowedOnSecondary::kNever; } -} configureCollectionAutoSplitCmd; +} configureCollectionBalancingCmd; } // namespace } // namespace mongo diff --git a/src/mongo/s/request_types/configure_collection_auto_split.idl b/src/mongo/s/request_types/configure_collection_balancing.idl index 2fec90fa1cd..df63b44cffe 100644 --- a/src/mongo/s/request_types/configure_collection_auto_split.idl +++ b/src/mongo/s/request_types/configure_collection_balancing.idl @@ -26,7 +26,7 @@ # it in the license file. # -# _configsvrConfigureCollectionAutoSplitter and configureCollectionAutoSplitter IDL File +# _configsvrConfigureCollectionBalancing and configureCollectionBalancing IDL File global: cpp_namespace: "mongo" @@ -35,19 +35,19 @@ imports: - "mongo/idl/basic_types.idl" feature_flags: - featureFlagPerCollectionAutoSplitter: - description: "Add capability to configure per collection auto-splitter settings." - cpp_varname: feature_flags::gShardingPerCollectionAutoSplitter + featureFlagPerCollBalancingSettings: + description: "Add capability to configure per collection balancing settings." + cpp_varname: feature_flags::gPerCollBalancingSettings default: false structs: - configure_auto_split_params: - description: "Parameters for configureCollectionAutoSplitter command" + configure_coll_balancing_params: + description: "Parameters for configureCollectionBalancing command" fields: - defaultChunkSize: + chunkSize: type: safeInt - cpp_name: defaultChunkSizeMB - description: "New default chunk size in MB, 0 will unset the collection specific chunk size." + cpp_name: chunkSizeMB + description: "New default chunk size in MiB, 0 will unset the collection specific chunk size." optional: true enableAutoSplitter: type: bool @@ -59,27 +59,27 @@ structs: optional: true commands: - configureAutoSplit: - command_name: configureCollectionAutoSplitter - cpp_name: ConfigureCollAutoSplit - description: "Public configureCollectionAutoSplitter command on mongos" + configureCollectionBalancing: + command_name: configureCollectionBalancing + cpp_name: ConfigureCollectionBalancing + description: "Public configureCollectionBalancing command on mongos" strict: false namespace: type api_version: "" reply_type: OkReply type: namespacestring chained_structs: - configure_auto_split_params: - cpp_name: ConfigureCollAutoSplit + configure_coll_balancing_params: + cpp_name: CollBalancingParams - _configsvrConfigureAutoSplit: - command_name: _configsvrConfigureAutoSplit - cpp_name: ConfigsvrConfigureCollAutoSplit - description: "Internal configureCollectionAutoSplitter command on the config server" + _configsvrConfigureCollectionBalancing: + command_name: _configsvrConfigureCollectionBalancing + cpp_name: ConfigsvrConfigureCollectionBalancing + description: "Internal configureCollectionBalancing command on the config server" strict: true namespace: type api_version: "" type: namespacestring chained_structs: - configure_auto_split_params: - cpp_name: ConfigureCollAutoSplit + configure_coll_balancing_params: + cpp_name: CollBalancingParams diff --git a/src/mongo/shell/utils_sh.js b/src/mongo/shell/utils_sh.js index c549278e9e5..e28d99e7ee0 100644 --- a/src/mongo/shell/utils_sh.js +++ b/src/mongo/shell/utils_sh.js @@ -94,9 +94,8 @@ sh.help = function() { print( "\tsh.balancerCollectionStatus(fullName) " + "returns wheter the specified collection is balanced or the balancer needs to take more actions on it"); - print( - "\tsh.configureCollectionAutoSplitter(fullName, params) " + - "configure both the default chunk size and the auto-splitting behaviour for a collection"); + print("\tsh.configureCollectionBalancing(fullName, params) " + + "configure balancing settings for a specific collection"); }; sh.status = function(verbose, configDB) { @@ -556,8 +555,8 @@ sh.balancerCollectionStatus = function(coll) { return sh._adminCommand({balancerCollectionStatus: coll}, true); }; -sh.configureCollectionAutoSplitter = function(coll) { - let cmd = {configureCollectionAutoSplitter: coll}; +sh.configureCollectionBalancing = function(coll) { + let cmd = {configureCollectionBalancing: coll}; if (opts) { cmd = Object.assign(cmd, opts); } |