summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/split_chunk.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2021-06-09 11:06:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-14 12:26:49 +0000
commit92a8ceb94681642b438c20351f95c441498a29cf (patch)
tree7920ab4707ea0b6e9cc4707a2b3f73f7eecb7c7e /src/mongo/db/s/split_chunk.cpp
parent69ea6153374eaa35128871ea13e48cd8735f0f04 (diff)
downloadmongo-92a8ceb94681642b438c20351f95c441498a29cf.tar.gz
SERVER-56654 Do not use the collection distributed lock for chunk splits
Diffstat (limited to 'src/mongo/db/s/split_chunk.cpp')
-rw-r--r--src/mongo/db/s/split_chunk.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/mongo/db/s/split_chunk.cpp b/src/mongo/db/s/split_chunk.cpp
index 9cd07adae36..3f6f3a63029 100644
--- a/src/mongo/db/s/split_chunk.cpp
+++ b/src/mongo/db/s/split_chunk.cpp
@@ -43,8 +43,8 @@
#include "mongo/db/keypattern.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/query/internal_plans.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/logv2/log.h"
@@ -133,16 +133,8 @@ StatusWith<boost::optional<ChunkRange>> splitChunk(OperationContext* opCtx,
const std::vector<BSONObj>& splitKeys,
const std::string& shardName,
const OID& expectedCollectionEpoch) {
- const std::string whyMessage(str::stream()
- << "splitting chunk " << redact(chunkRange.toString()) << " in "
- << nss.toString());
- auto scopedDistLock = DistLockManager::get(opCtx)->lock(
- opCtx, nss.ns(), whyMessage, DistLockManager::kDefaultLockTimeout);
- if (!scopedDistLock.isOK()) {
- return scopedDistLock.getStatus().withContext(
- str::stream() << "could not acquire collection lock for " << nss.toString()
- << " to split chunk " << chunkRange.toString());
- }
+ auto scopedSplitOrMergeChunk(uassertStatusOK(
+ ActiveMigrationsRegistry::get(opCtx).registerSplitOrMergeChunk(opCtx, nss, chunkRange)));
// If the shard key is hashed, then we must make sure that the split points are of supported
// data types.