From e16f9ca7c5ba0f3ca29a3ba2f0319b29805342dc Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 24 Apr 2017 23:54:07 +0200 Subject: [PATCH] Add check for distributeShardsLike to dropCollectionCoordinator. --- arangod/Cluster/ClusterInfo.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arangod/Cluster/ClusterInfo.cpp b/arangod/Cluster/ClusterInfo.cpp index 77cb5d9f49..bf08869762 100644 --- a/arangod/Cluster/ClusterInfo.cpp +++ b/arangod/Cluster/ClusterInfo.cpp @@ -1300,6 +1300,18 @@ int ClusterInfo::dropCollectionCoordinator(std::string const& databaseName, AgencyComm ac; AgencyCommResult res; + // First check that no other collection has a distributeShardsLike + // entry pointing to us: + auto coll = getCollection(databaseName, collectionID); + std::string id = std::to_string(coll->cid()); + auto colls = getCollections(databaseName); + for (std::shared_ptr const& p : colls) { + if (p->distributeShardsLike() == coll->name() || + p->distributeShardsLike() == collectionID) { + return TRI_ERROR_CLUSTER_MUST_NOT_DROP_COLL_OTHER_DISTRIBUTESHARDSLIKE; + } + } + double const realTimeout = getTimeout(timeout); double const endTime = TRI_microtime() + realTimeout; double const interval = getPollInterval();