summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/merge_chunks_command.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2021-05-21 06:30:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-21 06:53:51 +0000
commit3c8f5c86724afaf73adf8118c0c5564f59cc3f5a (patch)
tree1f481bb26cf4c70fb63501b4fb491ad5ebe386a7 /src/mongo/db/s/merge_chunks_command.cpp
parentb5dbc41e97ae3587beb40f31490f79b9be40e4bc (diff)
downloadmongo-3c8f5c86724afaf73adf8118c0c5564f59cc3f5a.tar.gz
SERVER-56779 Include forgotten file change on the v5.0 branch
Diffstat (limited to 'src/mongo/db/s/merge_chunks_command.cpp')
-rw-r--r--src/mongo/db/s/merge_chunks_command.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/mongo/db/s/merge_chunks_command.cpp b/src/mongo/db/s/merge_chunks_command.cpp
index 04cdc6e8c24..4e40e9d81bd 100644
--- a/src/mongo/db/s/merge_chunks_command.cpp
+++ b/src/mongo/db/s/merge_chunks_command.cpp
@@ -38,8 +38,8 @@
#include "mongo/db/commands.h"
#include "mongo/db/field_parser.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/db/s/active_migrations_registry.h"
#include "mongo/db/s/collection_sharding_runtime.h"
-#include "mongo/db/s/dist_lock_manager.h"
#include "mongo/db/s/shard_filtering_metadata_refresh.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/vector_clock.h"
@@ -78,14 +78,9 @@ void mergeChunks(OperationContext* opCtx,
const BSONObj& minKey,
const BSONObj& maxKey,
const OID& expectedEpoch) {
- const std::string whyMessage = str::stream() << "merging chunks in " << nss.ns() << " from "
- << redact(minKey) << " to " << redact(maxKey);
- auto scopedDistLock = uassertStatusOKWithContext(
- DistLockManager::get(opCtx)->lock(
- opCtx, nss.ns(), whyMessage, DistLockManager::kDefaultLockTimeout),
- str::stream() << "could not acquire collection lock for " << nss.ns()
- << " to merge chunks in [" << redact(minKey) << ", " << redact(maxKey)
- << ")");
+ auto scopedSplitOrMergeChunk(
+ uassertStatusOK(ActiveMigrationsRegistry::get(opCtx).registerSplitOrMergeChunk(
+ nss, ChunkRange(minKey, maxKey))));
auto const shardingState = ShardingState::get(opCtx);
@@ -141,7 +136,7 @@ void mergeChunks(OperationContext* opCtx,
!chunksToMerge.empty());
//
- // Validate the range starts and ends at chunks and has no holes, error if not valid
+ // Validate the range starts and ends at chunk boundaries and has no holes, error if not valid
//
BSONObj firstDocMin = chunksToMerge.front().getMin();