1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into devel

This commit is contained in:
Simon Grätzer 2017-04-25 16:03:57 +02:00
commit 7c1d19930e
1 changed files with 22 additions and 51 deletions

View File

@ -2012,67 +2012,38 @@ exports._drop = function (graphId, dropCollections) {
if (dropCollections === true) {
graphs = exports._listObjects();
var initialCollections = new Set(); // Here we collect the initial collection(s)
// Here we collect all collections
// that are leading for distribution
var initialCollections = new Set();
let dropColCB = (name) => {
if (checkIfMayBeDropped(name, graph._key, graphs)) {
try {
let colObj = db[name];
if (colObj !== undefined) {
// If it is undefined the collection is gone already
if (colObj.properties().distributeShardsLike !== undefined) {
db._drop(name);
} else {
initialCollections.add(name);
}
}
} catch (ignore) {}
}
};
// drop orphans
if (!graph.orphanCollections) {
graph.orphanCollections = [];
}
graph.orphanCollections.forEach(
function (oC) {
if (checkIfMayBeDropped(oC, graph._key, graphs)) {
try {
let colObj = db[oC];
if (colObj.properties().distributeShardsLike !== undefined) {
db._drop(oC);
} else {
initialCollections.add(oC);
}
} catch (ignore) {}
}
}
);
graph.orphanCollections.forEach(dropColCB);
var edgeDefinitions = graph.edgeDefinitions;
edgeDefinitions.forEach(
function (edgeDefinition) {
var from = edgeDefinition.from;
var to = edgeDefinition.to;
var collection = edgeDefinition.collection;
if (checkIfMayBeDropped(collection, graph._key, graphs)) {
let colObj = db[collection];
if (colObj.properties().distributeShardsLike !== undefined) {
db._drop(collection);
} else {
initialCollections.add(collection);
}
}
from.forEach(
function (col) {
if (checkIfMayBeDropped(col, graph._key, graphs)) {
try {
let colObj = db[col];
if (colObj.properties().distributeShardsLike !== undefined) {
db._drop(col);
} else {
initialCollections.add(col);
}
} catch (ignore) {}
}
}
);
to.forEach(
function (col) {
if (checkIfMayBeDropped(col, graph._key, graphs)) {
try {
let colObj = db[col];
if (colObj.properties().distributeShardsLike !== undefined) {
db._drop(col);
} else {
initialCollections.add(col);
}
} catch (ignore2) {}
}
}
);
dropColCB(edgeDefinition.collection);
from.forEach(dropColCB);
to.forEach(dropColCB);
}
);
for (let c of initialCollections) {