1
0
Fork 0

Add check for distributeShardsLike to dropCollectionCoordinator.

This commit is contained in:
Max Neunhoeffer 2017-04-24 23:54:07 +02:00
parent 0ce293bb6a
commit e16f9ca7c5
1 changed files with 12 additions and 0 deletions

View File

@ -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<LogicalCollection> 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();