diff options
author | Jordi Serra Torrens <jordi.serra-torrens@mongodb.com> | 2022-01-07 08:35:06 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-07 09:03:20 +0000 |
commit | 86773e0404ac646ad94e510852c0274bb9257b42 (patch) | |
tree | cf75b947f96d4df6af6aa7b47e7f8f88d6cf9e02 /src/mongo/s | |
parent | 774fe7d3a26749f9b71d17c8a5952ab412f3b2b0 (diff) | |
download | mongo-86773e0404ac646ad94e510852c0274bb9257b42.tar.gz |
SERVER-62064 Serialize resharding with other DDL operations on stepup
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/commands/cluster_reshard_collection_cmd.cpp | 19 | ||||
-rw-r--r-- | src/mongo/s/request_types/sharded_ddl_commands.idl | 60 | ||||
-rw-r--r-- | src/mongo/s/resharding/resharding_feature_flag.idl | 7 |
3 files changed, 53 insertions, 33 deletions
diff --git a/src/mongo/s/commands/cluster_reshard_collection_cmd.cpp b/src/mongo/s/commands/cluster_reshard_collection_cmd.cpp index 17c0e36eec1..91a20f8fd70 100644 --- a/src/mongo/s/commands/cluster_reshard_collection_cmd.cpp +++ b/src/mongo/s/commands/cluster_reshard_collection_cmd.cpp @@ -55,14 +55,21 @@ public: void typedRun(OperationContext* opCtx) { const auto& nss = ns(); - ShardsvrReshardCollection shardsvrReshardCollection(nss, request().getKey()); + + ShardsvrReshardCollection shardsvrReshardCollection(nss); shardsvrReshardCollection.setDbName(request().getDbName()); - shardsvrReshardCollection.setUnique(request().getUnique()); - shardsvrReshardCollection.setCollation(request().getCollation()); - shardsvrReshardCollection.set_presetReshardedChunks( + + ReshardCollectionRequest reshardCollectionRequest; + reshardCollectionRequest.setKey(request().getKey()); + reshardCollectionRequest.setUnique(request().getUnique()); + reshardCollectionRequest.setCollation(request().getCollation()); + reshardCollectionRequest.set_presetReshardedChunks( request().get_presetReshardedChunks()); - shardsvrReshardCollection.setZones(request().getZones()); - shardsvrReshardCollection.setNumInitialChunks(request().getNumInitialChunks()); + reshardCollectionRequest.setZones(request().getZones()); + reshardCollectionRequest.setNumInitialChunks(request().getNumInitialChunks()); + + shardsvrReshardCollection.setReshardCollectionRequest( + std::move(reshardCollectionRequest)); auto catalogCache = Grid::get(opCtx)->catalogCache(); const auto dbInfo = uassertStatusOK(catalogCache->getDatabase(opCtx, nss.db())); diff --git a/src/mongo/s/request_types/sharded_ddl_commands.idl b/src/mongo/s/request_types/sharded_ddl_commands.idl index b0151f36182..564a5849800 100644 --- a/src/mongo/s/request_types/sharded_ddl_commands.idl +++ b/src/mongo/s/request_types/sharded_ddl_commands.idl @@ -150,6 +150,37 @@ structs: description: "The index specification document to use as the new shard key." optional: false + ReshardCollectionRequest: + description: "Parameters for the reshard collection command" + strict: false + fields: + key: + type: object + description: "The index specification document to use as the new shard key." + optional: false + unique: + type: bool + description: "Whether the shard key index should enforce a unique constraint." + optional: true + numInitialChunks: + type: safeInt64 + description: "The number of chunks to create initially." + optional: true + collation: + type: object + description: "The collation to use for the shard key index." + optional: true + zones: + type: array<ReshardingZoneType> + description: "The zones associated with the new shard key." + optional: true + _presetReshardedChunks: + type: array<ReshardedChunk> + description: >- + "Mapping of chunk ranges to be used as the initial split output. This is only + for testing purposes." + optional: true + SetAllowMigrationsRequest: description: "Parameters sent for the set allow migrations command" strict: false @@ -268,33 +299,8 @@ commands: namespace: type api_version: "" type: namespacestring - fields: - key: - type: object - description: "The index specification document to use as the new shard key." - optional: false - unique: - type: bool - description: "Whether the shard key index should enforce a unique constraint." - optional: true - numInitialChunks: - type: safeInt64 - description: "The number of chunks to create initially." - optional: true - collation: - type: object - description: "The collation to use for the shard key index." - optional: true - zones: - type: array<ReshardingZoneType> - description: "The zones associated with the new shard key." - optional: true - _presetReshardedChunks: - type: array<ReshardedChunk> - description: >- - "Mapping of chunk ranges to be used as the initial split output. This is only for - testing purposes." - optional: true + chained_structs: + ReshardCollectionRequest: ReshardCollectionRequest _shardsvrRefineCollectionShardKey: description: "Parser for the _shardsvrRefineCollectionShardKey command" diff --git a/src/mongo/s/resharding/resharding_feature_flag.idl b/src/mongo/s/resharding/resharding_feature_flag.idl index e83de02e286..4179b4290f8 100644 --- a/src/mongo/s/resharding/resharding_feature_flag.idl +++ b/src/mongo/s/resharding/resharding_feature_flag.idl @@ -40,3 +40,10 @@ feature_flags: cpp_varname: gFeatureFlagResharding default: true version: 5.0 + + featureFlagRecoverableShardsvrReshardCollectionCoordinator: + description: When enabled, the db primary shard will use a recoverable + ShardingDDLCoordinator that ensures proper serialization of resharding and other DDL + operations even in the event of primary shard stepdowns. + cpp_varname: gFeatureFlagRecoverableShardsvrReshardCollectionCoordinator + default: false |