summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_drop_cmd.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-05-12 17:56:45 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-05-16 09:51:55 -0400
commit24c7c45f83155c72fee03a362b3e5a6a7b37f2a2 (patch)
treeff61b55b69e990d4e43011e7fc65e79429f2a265 /src/mongo/s/commands/cluster_drop_cmd.cpp
parent7ca9cebf2623865fd0077f90baf61132d866a674 (diff)
downloadmongo-24c7c45f83155c72fee03a362b3e5a6a7b37f2a2.tar.gz
SERVER-29017 Acquire the collection dist lock for unsharded drop
Diffstat (limited to 'src/mongo/s/commands/cluster_drop_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_drop_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/s/commands/cluster_drop_cmd.cpp b/src/mongo/s/commands/cluster_drop_cmd.cpp
index 0ca3e6396bd..20a2932ca8d 100644
--- a/src/mongo/s/commands/cluster_drop_cmd.cpp
+++ b/src/mongo/s/commands/cluster_drop_cmd.cpp
@@ -106,8 +106,12 @@ private:
const ShardId& shardId,
const NamespaceString& nss,
BSONObjBuilder* result) {
+ const auto catalogClient = Grid::get(opCtx)->catalogClient(opCtx);
const auto shardRegistry = Grid::get(opCtx)->shardRegistry();
+ auto scopedDistLock = uassertStatusOK(catalogClient->getDistLockManager()->lock(
+ opCtx, nss.ns(), "drop", DistLockManager::kDefaultLockTimeout));
+
const auto dropCommandBSON = [shardRegistry, opCtx, &shardId, &nss] {
BSONObjBuilder builder;
builder.append("drop", nss.coll());