mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
f15cb48a10
|
@ -3821,7 +3821,7 @@ bool BlockWithClients::preInitCursor () {
|
||||||
|
|
||||||
int ScatterBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
int ScatterBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
||||||
|
|
||||||
if (!preInitCursor()) {
|
if (! preInitCursor()) {
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3842,7 +3842,7 @@ int ScatterBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
||||||
/// @brief hasMoreForShard: any more for shard <shardId>?
|
/// @brief hasMoreForShard: any more for shard <shardId>?
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool ScatterBlock::hasMoreForShard (std::string const& shardId){
|
bool ScatterBlock::hasMoreForShard (std::string const& shardId) {
|
||||||
size_t clientId = getClientId(shardId);
|
size_t clientId = getClientId(shardId);
|
||||||
|
|
||||||
if (_doneForClient.at(clientId)) {
|
if (_doneForClient.at(clientId)) {
|
||||||
|
@ -3897,7 +3897,7 @@ int64_t ScatterBlock::remainingForShard (std::string const& shardId) {
|
||||||
|
|
||||||
int ScatterBlock::getOrSkipSomeForShard (size_t atLeast,
|
int ScatterBlock::getOrSkipSomeForShard (size_t atLeast,
|
||||||
size_t atMost, bool skipping, AqlItemBlock*& result,
|
size_t atMost, bool skipping, AqlItemBlock*& result,
|
||||||
size_t& skipped, std::string const& shardId){
|
size_t& skipped, std::string const& shardId) {
|
||||||
|
|
||||||
TRI_ASSERT(0 < atLeast && atLeast <= atMost);
|
TRI_ASSERT(0 < atLeast && atLeast <= atMost);
|
||||||
TRI_ASSERT(result == nullptr && skipped == 0);
|
TRI_ASSERT(result == nullptr && skipped == 0);
|
||||||
|
|
|
@ -1684,13 +1684,15 @@ namespace triagens {
|
||||||
ScatterBlock (ExecutionEngine* engine,
|
ScatterBlock (ExecutionEngine* engine,
|
||||||
ScatterNode const* ep,
|
ScatterNode const* ep,
|
||||||
std::vector<std::string> const& shardIds)
|
std::vector<std::string> const& shardIds)
|
||||||
: BlockWithClients(engine, ep, shardIds) {}
|
: BlockWithClients(engine, ep, shardIds) {
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief destructor
|
/// @brief destructor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
~ScatterBlock () {}
|
~ScatterBlock () {
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief initializeCursor
|
/// @brief initializeCursor
|
||||||
|
@ -1755,7 +1757,8 @@ namespace triagens {
|
||||||
/// @brief destructor
|
/// @brief destructor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
~DistributeBlock () {}
|
~DistributeBlock () {
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief initializeCursor
|
/// @brief initializeCursor
|
||||||
|
@ -1767,7 +1770,7 @@ namespace triagens {
|
||||||
/// @brief remainingForShard: remaining for shard <shardId>?
|
/// @brief remainingForShard: remaining for shard <shardId>?
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int64_t remainingForShard (std::string const& shardId){
|
int64_t remainingForShard (std::string const& shardId) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -889,7 +889,9 @@ int ArangoServer::startupServer () {
|
||||||
|
|
||||||
// for a cluster coordinator, the users are loaded at a later stage;
|
// for a cluster coordinator, the users are loaded at a later stage;
|
||||||
// the kickstarter will trigger a bootstrap process
|
// the kickstarter will trigger a bootstrap process
|
||||||
if (ServerState::instance()->getRole() != ServerState::ROLE_COORDINATOR) {
|
const auto role = ServerState::instance()->getRole();
|
||||||
|
|
||||||
|
if (role != ServerState::ROLE_COORDINATOR && role != ServerState::ROLE_PRIMARY && role != ServerState::ROLE_SECONDARY) {
|
||||||
|
|
||||||
// if the authentication info could not be loaded, but authentication is turned on,
|
// if the authentication info could not be loaded, but authentication is turned on,
|
||||||
// then we refuse to start
|
// then we refuse to start
|
||||||
|
|
|
@ -280,7 +280,7 @@ static int SetupExampleObject (v8::Handle<v8::Object> const example,
|
||||||
static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx,
|
static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx,
|
||||||
TRI_shaper_t* shaper,
|
TRI_shaper_t* shaper,
|
||||||
v8::Handle<v8::Object> conditions) {
|
v8::Handle<v8::Object> conditions) {
|
||||||
TRI_index_operator_t* lastOperator = 0;
|
TRI_index_operator_t* lastOperator = nullptr;
|
||||||
size_t numEq = 0;
|
size_t numEq = 0;
|
||||||
size_t lastNonEq = 0;
|
size_t lastNonEq = 0;
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx,
|
||||||
MEM_ERROR:
|
MEM_ERROR:
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, parameters);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, parameters);
|
||||||
|
|
||||||
if (lastOperator == nullptr) {
|
if (lastOperator != nullptr) {
|
||||||
TRI_FreeIndexOperator(lastOperator);
|
TRI_FreeIndexOperator(lastOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,8 +411,8 @@
|
||||||
|
|
||||||
this.collection.each(function(model) {
|
this.collection.each(function(model) {
|
||||||
self.customQueries.push({
|
self.customQueries.push({
|
||||||
name: model.attributes.name,
|
name: model.get("name"),
|
||||||
value: model.attributes.value
|
value: model.get("value")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -4589,7 +4589,6 @@ function TRAVERSAL_VISITOR (config, result, vertex, path) {
|
||||||
|
|
||||||
function TRAVERSAL_NEIGHBOR_VISITOR (config, result, vertex, path) {
|
function TRAVERSAL_NEIGHBOR_VISITOR (config, result, vertex, path) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
result.push(CLONE({ vertex: vertex, path: path, startVertex : config.startVertex }));
|
result.push(CLONE({ vertex: vertex, path: path, startVertex : config.startVertex }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4653,10 +4652,23 @@ function TRAVERSAL_EDGE_EXAMPLE_FILTER (config, vertex, edge, path) {
|
||||||
|
|
||||||
function TRAVERSAL_VERTEX_FILTER (config, vertex, path) {
|
function TRAVERSAL_VERTEX_FILTER (config, vertex, path) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
if (config.filterVertexExamples && !MATCHES(vertex, config.filterVertexExamples)) {
|
||||||
if (! MATCHES(vertex, config.filterVertexExamples)) {
|
if (config.filterVertexCollections
|
||||||
|
&& config.vertexFilterMethod.indexOf("exclude") === -1
|
||||||
|
&& config.filterVertexCollections.indexOf(vertex._id.split("/")[0]) === -1
|
||||||
|
) {
|
||||||
|
if (config.vertexFilterMethod.indexOf("prune") === -1) {
|
||||||
|
return ["exclude"];
|
||||||
|
}
|
||||||
|
return ["prune", "exclude"];
|
||||||
|
}
|
||||||
return config.vertexFilterMethod;
|
return config.vertexFilterMethod;
|
||||||
}
|
}
|
||||||
|
if (config.filterVertexCollections
|
||||||
|
&& config.filterVertexCollections.indexOf(vertex._id.split("/")[0]) === -1
|
||||||
|
){
|
||||||
|
return ["exclude"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -4789,6 +4801,11 @@ function TRAVERSAL_FUNC (func,
|
||||||
config.vertexFilterMethod = params.vertexFilterMethod || ["prune", "exclude"];
|
config.vertexFilterMethod = params.vertexFilterMethod || ["prune", "exclude"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (params.filterVertexCollections) {
|
||||||
|
config.filter = config.filter || TRAVERSAL_VERTEX_FILTER;
|
||||||
|
config.vertexFilterMethod = config.vertexFilterMethod || ["prune", "exclude"];
|
||||||
|
config.filterVertexCollections = params.filterVertexCollections;
|
||||||
|
}
|
||||||
|
|
||||||
if (params._sort) {
|
if (params._sort) {
|
||||||
config.sort = function (l, r) { return l._key < r._key ? -1 : 1; };
|
config.sort = function (l, r) { return l._key < r._key ? -1 : 1; };
|
||||||
|
@ -6020,8 +6037,8 @@ function GRAPH_NEIGHBORS (vertexCollection,
|
||||||
/// * *edgeCollectionRestriction* : One or multiple edge
|
/// * *edgeCollectionRestriction* : One or multiple edge
|
||||||
/// collection names. Only edges from these collections will be considered for the path.
|
/// collection names. Only edges from these collections will be considered for the path.
|
||||||
/// * *vertexCollectionRestriction* : One or multiple vertex
|
/// * *vertexCollectionRestriction* : One or multiple vertex
|
||||||
/// collection names. Only vertices from these collections will be considered as
|
/// collection names. Only vertices from these collections will be contained in the
|
||||||
/// neighbor.
|
/// result. This does not effect vertices on the path.
|
||||||
/// * *minDepth* : Defines the minimal
|
/// * *minDepth* : Defines the minimal
|
||||||
/// depth a path to a neighbor must have to be returned (default is 1).
|
/// depth a path to a neighbor must have to be returned (default is 1).
|
||||||
/// * *maxDepth* : Defines the maximal
|
/// * *maxDepth* : Defines the maximal
|
||||||
|
@ -6064,22 +6081,13 @@ function GENERAL_GRAPH_NEIGHBORS (graphName,
|
||||||
}
|
}
|
||||||
|
|
||||||
options.fromVertexExample = vertexExample;
|
options.fromVertexExample = vertexExample;
|
||||||
if (! options.direction) {
|
if (! options.hasOwnProperty("direction")) {
|
||||||
options.direction = 'any';
|
options.direction = 'any';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.vertexCollectionRestriction) {
|
if (options.hasOwnProperty("neighborExamples") && typeof options.neighborExamples === "string") {
|
||||||
if (options.direction === "inbound") {
|
|
||||||
options.endVertexCollectionRestriction = options.vertexCollectionRestriction;
|
|
||||||
} else {
|
|
||||||
options.startVertexCollectionRestriction = options.vertexCollectionRestriction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (options.neighborExamples) {
|
|
||||||
if (typeof options.neighborExamples === "string") {
|
|
||||||
options.neighborExamples = {_id : options.neighborExamples};
|
options.neighborExamples = {_id : options.neighborExamples};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
var neighbors = [],
|
var neighbors = [],
|
||||||
params = TRAVERSAL_PARAMS(),
|
params = TRAVERSAL_PARAMS(),
|
||||||
factory = TRAVERSAL.generalGraphDatasourceFactory(graphName);
|
factory = TRAVERSAL.generalGraphDatasourceFactory(graphName);
|
||||||
|
@ -6094,6 +6102,9 @@ function GENERAL_GRAPH_NEIGHBORS (graphName,
|
||||||
if (options.edgeCollectionRestriction) {
|
if (options.edgeCollectionRestriction) {
|
||||||
params.edgeCollectionRestriction = options.edgeCollectionRestriction;
|
params.edgeCollectionRestriction = options.edgeCollectionRestriction;
|
||||||
}
|
}
|
||||||
|
if (options.vertexCollectionRestriction) {
|
||||||
|
params.filterVertexCollections = options.vertexCollectionRestriction;
|
||||||
|
}
|
||||||
fromVertices.forEach(function (v) {
|
fromVertices.forEach(function (v) {
|
||||||
var e = TRAVERSAL_FUNC("GRAPH_NEIGHBORS",
|
var e = TRAVERSAL_FUNC("GRAPH_NEIGHBORS",
|
||||||
factory,
|
factory,
|
||||||
|
|
|
@ -33,6 +33,7 @@ var TRAVERSAL = require("org/arangodb/graph/traversal");
|
||||||
var ArangoError = require("org/arangodb").ArangoError;
|
var ArangoError = require("org/arangodb").ArangoError;
|
||||||
var ShapedJson = INTERNAL.ShapedJson;
|
var ShapedJson = INTERNAL.ShapedJson;
|
||||||
var isCoordinator = require("org/arangodb/cluster").isCoordinator();
|
var isCoordinator = require("org/arangodb/cluster").isCoordinator();
|
||||||
|
var console = require("console");
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private variables
|
// --SECTION-- private variables
|
||||||
|
@ -491,10 +492,15 @@ function FCALL_USER (name, parameters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserFunctions[prefix].hasOwnProperty(name)) {
|
if (UserFunctions[prefix].hasOwnProperty(name)) {
|
||||||
|
try {
|
||||||
var result = UserFunctions[prefix][name].func.apply(null, parameters);
|
var result = UserFunctions[prefix][name].func.apply(null, parameters);
|
||||||
|
|
||||||
return FIX_VALUE(result);
|
return FIX_VALUE(result);
|
||||||
}
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.warn("AQL user function '%s' returned an exception. result is converted to null", name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_NOT_FOUND, NORMALIZE_FNAME(name));
|
THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_NOT_FOUND, NORMALIZE_FNAME(name));
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -495,9 +495,6 @@ function TaskSuite () {
|
||||||
|
|
||||||
internal.wait(1);
|
internal.wait(1);
|
||||||
|
|
||||||
var t = getTasks();
|
|
||||||
assertEqual(0, t.length);
|
|
||||||
|
|
||||||
internal.wait(5);
|
internal.wait(5);
|
||||||
|
|
||||||
assertEqual(1, db[cn].count());
|
assertEqual(1, db[cn].count());
|
||||||
|
@ -529,17 +526,9 @@ function TaskSuite () {
|
||||||
assertEqual(5, task.offset);
|
assertEqual(5, task.offset);
|
||||||
assertEqual("_system", task.database);
|
assertEqual("_system", task.database);
|
||||||
|
|
||||||
var t = getTasks();
|
|
||||||
assertEqual(1, t.length);
|
|
||||||
|
|
||||||
internal.wait(15);
|
internal.wait(15);
|
||||||
|
|
||||||
assertEqual(1, db[cn].count());
|
assertEqual(1, db[cn].count());
|
||||||
// assertEqual(1, db[cn].byExample({ value: 23 }).toArray().length);
|
|
||||||
|
|
||||||
// task should have gone by now
|
|
||||||
// t = getTasks();
|
|
||||||
// assertEqual(0, t.length);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue