1
0
Fork 0

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

This commit is contained in:
jsteemann 2017-04-25 16:09:08 +02:00
commit 95f9439174
1 changed files with 22 additions and 51 deletions

View File

@ -2012,67 +2012,38 @@ exports._drop = function (graphId, dropCollections) {
if (dropCollections === true) { if (dropCollections === true) {
graphs = exports._listObjects(); 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 // drop orphans
if (!graph.orphanCollections) { if (!graph.orphanCollections) {
graph.orphanCollections = []; graph.orphanCollections = [];
} }
graph.orphanCollections.forEach( graph.orphanCollections.forEach(dropColCB);
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) {}
}
}
);
var edgeDefinitions = graph.edgeDefinitions; var edgeDefinitions = graph.edgeDefinitions;
edgeDefinitions.forEach( edgeDefinitions.forEach(
function (edgeDefinition) { function (edgeDefinition) {
var from = edgeDefinition.from; var from = edgeDefinition.from;
var to = edgeDefinition.to; var to = edgeDefinition.to;
var collection = edgeDefinition.collection; var collection = edgeDefinition.collection;
if (checkIfMayBeDropped(collection, graph._key, graphs)) { dropColCB(edgeDefinition.collection);
let colObj = db[collection]; from.forEach(dropColCB);
if (colObj.properties().distributeShardsLike !== undefined) { to.forEach(dropColCB);
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) {}
}
}
);
} }
); );
for (let c of initialCollections) { for (let c of initialCollections) {