mirror of https://gitee.com/bigwinds/arangodb
Bug fix 3.5/arangosh gharial vertex deletion (#9926)
* typo in route * unused function removed * added general graph standalone and cluster tests, formatting * removed fail, removed print * changelog * Update CHANGELOG
This commit is contained in:
parent
6f16c3deef
commit
e5da8b1cef
|
@ -52,6 +52,10 @@ v3.5.1 (XXXX-XX-XX)
|
||||||
This change also makes arangorestore restore the `_system` database last if it
|
This change also makes arangorestore restore the `_system` database last if it
|
||||||
is started with the `--all-databases` option.
|
is started with the `--all-databases` option.
|
||||||
|
|
||||||
|
* Fixed the removal (including a collection drop) of an orphanCollection from a
|
||||||
|
graph definition when using the arango shell. The boolean flag whether to drop
|
||||||
|
the collection or not was not transferred properly.
|
||||||
|
|
||||||
* Check for duplicate server endpoints registered in the agency in sub-keys of
|
* Check for duplicate server endpoints registered in the agency in sub-keys of
|
||||||
`/Current/ServersRegistered`.
|
`/Current/ServersRegistered`.
|
||||||
|
|
||||||
|
|
|
@ -119,9 +119,9 @@ CommonGraph.prototype._addVertexCollection = function (name, createCollection) {
|
||||||
CommonGraph.prototype._removeVertexCollection = function (name, dropCollection) {
|
CommonGraph.prototype._removeVertexCollection = function (name, dropCollection) {
|
||||||
let uri = GRAPH_PREFIX + encodeURIComponent(this.__name) + "/vertex/" + encodeURIComponent(name);
|
let uri = GRAPH_PREFIX + encodeURIComponent(this.__name) + "/vertex/" + encodeURIComponent(name);
|
||||||
if (dropCollection === true) {
|
if (dropCollection === true) {
|
||||||
uri += "?dropCollections=true";
|
uri += "?dropCollection=true";
|
||||||
} else {
|
} else {
|
||||||
uri += "?dropCollections=false";
|
uri += "?dropCollection=false";
|
||||||
}
|
}
|
||||||
const requestResult = arangosh.checkRequestResult(db._connection.DELETE(uri));
|
const requestResult = arangosh.checkRequestResult(db._connection.DELETE(uri));
|
||||||
const graph = requestResult.graph;
|
const graph = requestResult.graph;
|
||||||
|
|
|
@ -1566,44 +1566,6 @@ class Graph {
|
||||||
return this.__orphanCollections;
|
return this.__orphanCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
|
||||||
// / @brief was docuBlock JSF_general_graph__removeVertexCollection
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
_removeVertexCollection (vertexCollectionName, dropCollection) {
|
|
||||||
var err;
|
|
||||||
if (db._collection(vertexCollectionName) === null) {
|
|
||||||
err = new ArangoError();
|
|
||||||
err.errorNum = arangodb.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code;
|
|
||||||
err.errorMessage = arangodb.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message;
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
var index = this.__orphanCollections.indexOf(vertexCollectionName);
|
|
||||||
if (index === -1) {
|
|
||||||
err = new ArangoError();
|
|
||||||
err.errorNum = arangodb.errors.ERROR_GRAPH_NOT_IN_ORPHAN_COLLECTION.code;
|
|
||||||
err.errorMessage = arangodb.errors.ERROR_GRAPH_NOT_IN_ORPHAN_COLLECTION.message;
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dropCollection) {
|
|
||||||
checkRWPermission(vertexCollectionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.__orphanCollections.splice(index, 1);
|
|
||||||
delete this[vertexCollectionName];
|
|
||||||
db._graphs.update(this.__name, {orphanCollections: this.__orphanCollections});
|
|
||||||
|
|
||||||
if (dropCollection === true) {
|
|
||||||
var graphs = exports._listObjects();
|
|
||||||
if (checkIfMayBeDropped(vertexCollectionName, null, graphs)) {
|
|
||||||
db._drop(vertexCollectionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateBindCollections(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief was docuBlock JSF_general_graph_connectingEdges
|
// / @brief was docuBlock JSF_general_graph_connectingEdges
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
const arangodb = require('@arangodb');
|
const arangodb = require('@arangodb');
|
||||||
const expect = require('chai').expect;
|
const expect = require('chai').expect;
|
||||||
const graph = require("@arangodb/general-graph");
|
const graph = require("@arangodb/general-graph");
|
||||||
|
const _ = require("lodash");
|
||||||
const db = arangodb.db;
|
const db = arangodb.db;
|
||||||
|
|
||||||
describe('General graph creation', function () {
|
describe('General graph creation', function () {
|
||||||
|
@ -66,7 +67,7 @@ describe('General graph creation', function () {
|
||||||
describe('with defaults', function () {
|
describe('with defaults', function () {
|
||||||
let g;
|
let g;
|
||||||
|
|
||||||
before(function() {
|
before(function () {
|
||||||
let rel = graph._relation(en, vn, vn);
|
let rel = graph._relation(en, vn, vn);
|
||||||
// Create with default options
|
// Create with default options
|
||||||
g = graph._create(gn, [rel], [on]);
|
g = graph._create(gn, [rel], [on]);
|
||||||
|
@ -138,7 +139,7 @@ describe('General graph creation', function () {
|
||||||
|
|
||||||
describe('adding collections later', function () {
|
describe('adding collections later', function () {
|
||||||
|
|
||||||
before(function() {
|
before(function () {
|
||||||
let rel = graph._relation(en2, vn2, vn2);
|
let rel = graph._relation(en2, vn2, vn2);
|
||||||
g._extendEdgeDefinitions(rel);
|
g._extendEdgeDefinitions(rel);
|
||||||
g._addVertexCollection(on2);
|
g._addVertexCollection(on2);
|
||||||
|
@ -190,7 +191,7 @@ describe('General graph creation', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('modify edge definition', function () {
|
describe('modify edge definition', function () {
|
||||||
before(function() {
|
before(function () {
|
||||||
// We modify the first relation by adding a new vertex collection
|
// We modify the first relation by adding a new vertex collection
|
||||||
let rel = graph._relation(en, vn, vn3);
|
let rel = graph._relation(en, vn, vn3);
|
||||||
g._editEdgeDefinitions(rel);
|
g._editEdgeDefinitions(rel);
|
||||||
|
@ -225,7 +226,7 @@ describe('General graph creation', function () {
|
||||||
const replicationFactor = 2;
|
const replicationFactor = 2;
|
||||||
const numberOfShards = 3;
|
const numberOfShards = 3;
|
||||||
|
|
||||||
before(function() {
|
before(function () {
|
||||||
const options = {
|
const options = {
|
||||||
replicationFactor,
|
replicationFactor,
|
||||||
numberOfShards
|
numberOfShards
|
||||||
|
@ -301,7 +302,7 @@ describe('General graph creation', function () {
|
||||||
|
|
||||||
describe('adding collections later', function () {
|
describe('adding collections later', function () {
|
||||||
|
|
||||||
before(function() {
|
before(function () {
|
||||||
let rel = graph._relation(en2, vn2, vn2);
|
let rel = graph._relation(en2, vn2, vn2);
|
||||||
g._extendEdgeDefinitions(rel);
|
g._extendEdgeDefinitions(rel);
|
||||||
g._addVertexCollection(on2);
|
g._addVertexCollection(on2);
|
||||||
|
@ -353,35 +354,46 @@ describe('General graph creation', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('modify edge definition', function () {
|
describe('modify edge definition', function () {
|
||||||
before(function() {
|
before(function () {
|
||||||
// We modify the first relation by adding a new vertex collection
|
// We modify the first relation by adding a new vertex collection
|
||||||
let rel = graph._relation(en, vn, vn3);
|
let rel = graph._relation(en, vn, vn3);
|
||||||
g._editEdgeDefinitions(rel);
|
g._editEdgeDefinitions(rel);
|
||||||
|
|
||||||
expect(db._collection(vn3)).to.exist;
|
expect(db._collection(vn3)).to.exist;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('replication factor', function () {
|
describe('replication factor', function () {
|
||||||
|
|
||||||
it(`should be ${replicationFactor} for vertex collection`, function () {
|
it(`should be ${replicationFactor} for vertex collection`, function () {
|
||||||
let props = db._collection(vn3).properties();
|
let props = db._collection(vn3).properties();
|
||||||
expect(props.replicationFactor).to.equal(replicationFactor);
|
expect(props.replicationFactor).to.equal(replicationFactor);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('number of shards', function () {
|
describe('number of shards', function () {
|
||||||
|
|
||||||
it(`should be ${numberOfShards} for vertex collection`, function () {
|
it(`should be ${numberOfShards} for vertex collection`, function () {
|
||||||
let props = db._collection(vn3).properties();
|
let props = db._collection(vn3).properties();
|
||||||
expect(props.numberOfShards).to.equal(numberOfShards);
|
expect(props.numberOfShards).to.equal(numberOfShards);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('modify vertices', function () {
|
||||||
|
it(`remove a vertex collection from the graph definition and also drop the collection`, function () {
|
||||||
|
expect(db[on].name() === on);
|
||||||
|
g._removeVertexCollection(on, true);
|
||||||
|
|
||||||
|
// check that the collection is really dropped
|
||||||
|
// using collections list
|
||||||
|
var collections = db._collections();
|
||||||
|
var found = false;
|
||||||
|
_.each(collections, function (collection) {
|
||||||
|
if (collection.name() === on) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(found).to.be.false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue