diff options
-rw-r--r-- | jstests/sharding/resharding_disallow_writes.js | 8 | ||||
-rw-r--r-- | jstests/sharding/resharding_prohibited_commands.js | 2 | ||||
-rw-r--r-- | src/mongo/db/s/shardsvr_reshard_collection_command.cpp | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/jstests/sharding/resharding_disallow_writes.js b/jstests/sharding/resharding_disallow_writes.js index 2e7362823d1..fe814c237ce 100644 --- a/jstests/sharding/resharding_disallow_writes.js +++ b/jstests/sharding/resharding_disallow_writes.js @@ -82,14 +82,6 @@ reshardingTest.withReshardingInBackground( {dropIndexes: collName, index: {oldKey: 1}, maxTimeMS: 5000}), ErrorCodes.ReshardCollectionInProgress); - // TODO(SERVER-54635): This currently succeeds when the - // featureFlagShardingFullDDLSupport parameter is enabled. Uncomment the code below when - // this is fixed. - // jsTestLog("Attempting drop collection"); - // assert.commandFailedWithCode( - // sourceCollection.runCommand({drop: collName, maxTimeMS: 5000}), - // ErrorCodes.MaxTimeMSExpired); - jsTestLog("Completed operations"); } }); diff --git a/jstests/sharding/resharding_prohibited_commands.js b/jstests/sharding/resharding_prohibited_commands.js index c58862cc86d..1b6283a2b7a 100644 --- a/jstests/sharding/resharding_prohibited_commands.js +++ b/jstests/sharding/resharding_prohibited_commands.js @@ -51,7 +51,7 @@ reshardingTest.withReshardingInBackground( assert.commandFailedWithCode( mongos.adminCommand({moveChunk: ns, find: {oldKey: -10}, to: donorShardNames[1]}), - ErrorCodes.ConflictingOperationInProgress); + ErrorCodes.LockBusy); assert.commandFailedWithCode(db.runCommand({collMod: 'coll'}), ErrorCodes.ReshardCollectionInProgress); assert.commandFailedWithCode(sourceCollection.createIndexes([{newKey: 1}]), diff --git a/src/mongo/db/s/shardsvr_reshard_collection_command.cpp b/src/mongo/db/s/shardsvr_reshard_collection_command.cpp index fa6dbad0907..04c8aa85521 100644 --- a/src/mongo/db/s/shardsvr_reshard_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_reshard_collection_command.cpp @@ -33,6 +33,7 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" +#include "mongo/db/s/dist_lock_manager.h" #include "mongo/db/s/reshard_collection_coordinator.h" #include "mongo/db/s/sharding_state.h" #include "mongo/s/request_types/sharded_ddl_commands_gen.h" @@ -76,6 +77,13 @@ public: "Resharding is not supported for this version, please update the FCV to latest.", !serverGlobalParams.featureCompatibility.isUpgradingOrDowngrading()); + DistLockManager::ScopedDistLock dbDistLock( + uassertStatusOK(DistLockManager::get(opCtx)->lock( + opCtx, ns().db(), "reshardCollection", DistLockManager::kDefaultLockTimeout))); + DistLockManager::ScopedDistLock collDistLock( + uassertStatusOK(DistLockManager::get(opCtx)->lock( + opCtx, ns().ns(), "reshardCollection", DistLockManager::kDefaultLockTimeout))); + auto reshardCollectionCoordinator = std::make_shared<ReshardCollectionCoordinator>(opCtx, request()); reshardCollectionCoordinator->run(opCtx).get(opCtx); |