mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
95f9439174
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue