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) {
|
||||
|
||||
if (!preInitCursor()) {
|
||||
if (! preInitCursor()) {
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -3842,7 +3842,7 @@ int ScatterBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
|||
/// @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);
|
||||
|
||||
if (_doneForClient.at(clientId)) {
|
||||
|
@ -3897,7 +3897,7 @@ int64_t ScatterBlock::remainingForShard (std::string const& shardId) {
|
|||
|
||||
int ScatterBlock::getOrSkipSomeForShard (size_t atLeast,
|
||||
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(result == nullptr && skipped == 0);
|
||||
|
@ -3967,8 +3967,8 @@ DistributeBlock::DistributeBlock (ExecutionEngine* engine,
|
|||
DistributeNode const* ep,
|
||||
std::vector<std::string> const& shardIds,
|
||||
Collection const* collection)
|
||||
: BlockWithClients(engine, ep, shardIds),
|
||||
_collection(collection) {
|
||||
: BlockWithClients(engine, ep, shardIds),
|
||||
_collection(collection) {
|
||||
|
||||
// get the variable to inspect . . .
|
||||
VariableId varId = ep->_varId;
|
||||
|
|
|
@ -1684,13 +1684,15 @@ namespace triagens {
|
|||
ScatterBlock (ExecutionEngine* engine,
|
||||
ScatterNode const* ep,
|
||||
std::vector<std::string> const& shardIds)
|
||||
: BlockWithClients(engine, ep, shardIds) {}
|
||||
: BlockWithClients(engine, ep, shardIds) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
~ScatterBlock () {}
|
||||
~ScatterBlock () {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initializeCursor
|
||||
|
@ -1755,7 +1757,8 @@ namespace triagens {
|
|||
/// @brief destructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
~DistributeBlock () {}
|
||||
~DistributeBlock () {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initializeCursor
|
||||
|
@ -1767,7 +1770,7 @@ namespace triagens {
|
|||
/// @brief remainingForShard: remaining for shard <shardId>?
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int64_t remainingForShard (std::string const& shardId){
|
||||
int64_t remainingForShard (std::string const& shardId) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -889,7 +889,9 @@ int ArangoServer::startupServer () {
|
|||
|
||||
// for a cluster coordinator, the users are loaded at a later stage;
|
||||
// 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,
|
||||
// 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,
|
||||
TRI_shaper_t* shaper,
|
||||
v8::Handle<v8::Object> conditions) {
|
||||
TRI_index_operator_t* lastOperator = 0;
|
||||
TRI_index_operator_t* lastOperator = nullptr;
|
||||
size_t numEq = 0;
|
||||
size_t lastNonEq = 0;
|
||||
|
||||
|
@ -449,7 +449,7 @@ static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx,
|
|||
MEM_ERROR:
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, parameters);
|
||||
|
||||
if (lastOperator == nullptr) {
|
||||
if (lastOperator != nullptr) {
|
||||
TRI_FreeIndexOperator(lastOperator);
|
||||
}
|
||||
|
||||
|
|
|
@ -411,8 +411,8 @@
|
|||
|
||||
this.collection.each(function(model) {
|
||||
self.customQueries.push({
|
||||
name: model.attributes.name,
|
||||
value: model.attributes.value
|
||||
name: model.get("name"),
|
||||
value: model.get("value")
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -4589,7 +4589,6 @@ function TRAVERSAL_VISITOR (config, result, vertex, path) {
|
|||
|
||||
function TRAVERSAL_NEIGHBOR_VISITOR (config, result, vertex, path) {
|
||||
"use strict";
|
||||
|
||||
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) {
|
||||
"use strict";
|
||||
|
||||
if (! MATCHES(vertex, config.filterVertexExamples)) {
|
||||
if (config.filterVertexExamples && !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;
|
||||
}
|
||||
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"];
|
||||
}
|
||||
}
|
||||
if (params.filterVertexCollections) {
|
||||
config.filter = config.filter || TRAVERSAL_VERTEX_FILTER;
|
||||
config.vertexFilterMethod = config.vertexFilterMethod || ["prune", "exclude"];
|
||||
config.filterVertexCollections = params.filterVertexCollections;
|
||||
}
|
||||
|
||||
if (params._sort) {
|
||||
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
|
||||
/// collection names. Only edges from these collections will be considered for the path.
|
||||
/// * *vertexCollectionRestriction* : One or multiple vertex
|
||||
/// collection names. Only vertices from these collections will be considered as
|
||||
/// neighbor.
|
||||
/// collection names. Only vertices from these collections will be contained in the
|
||||
/// result. This does not effect vertices on the path.
|
||||
/// * *minDepth* : Defines the minimal
|
||||
/// depth a path to a neighbor must have to be returned (default is 1).
|
||||
/// * *maxDepth* : Defines the maximal
|
||||
|
@ -6064,21 +6081,12 @@ function GENERAL_GRAPH_NEIGHBORS (graphName,
|
|||
}
|
||||
|
||||
options.fromVertexExample = vertexExample;
|
||||
if (! options.direction) {
|
||||
if (! options.hasOwnProperty("direction")) {
|
||||
options.direction = 'any';
|
||||
}
|
||||
|
||||
if (options.vertexCollectionRestriction) {
|
||||
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};
|
||||
}
|
||||
if (options.hasOwnProperty("neighborExamples") && typeof options.neighborExamples === "string") {
|
||||
options.neighborExamples = {_id : options.neighborExamples};
|
||||
}
|
||||
var neighbors = [],
|
||||
params = TRAVERSAL_PARAMS(),
|
||||
|
@ -6094,6 +6102,9 @@ function GENERAL_GRAPH_NEIGHBORS (graphName,
|
|||
if (options.edgeCollectionRestriction) {
|
||||
params.edgeCollectionRestriction = options.edgeCollectionRestriction;
|
||||
}
|
||||
if (options.vertexCollectionRestriction) {
|
||||
params.filterVertexCollections = options.vertexCollectionRestriction;
|
||||
}
|
||||
fromVertices.forEach(function (v) {
|
||||
var e = TRAVERSAL_FUNC("GRAPH_NEIGHBORS",
|
||||
factory,
|
||||
|
|
|
@ -33,6 +33,7 @@ var TRAVERSAL = require("org/arangodb/graph/traversal");
|
|||
var ArangoError = require("org/arangodb").ArangoError;
|
||||
var ShapedJson = INTERNAL.ShapedJson;
|
||||
var isCoordinator = require("org/arangodb/cluster").isCoordinator();
|
||||
var console = require("console");
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
|
@ -491,9 +492,14 @@ function FCALL_USER (name, parameters) {
|
|||
}
|
||||
|
||||
if (UserFunctions[prefix].hasOwnProperty(name)) {
|
||||
var result = UserFunctions[prefix][name].func.apply(null, parameters);
|
||||
|
||||
return FIX_VALUE(result);
|
||||
try {
|
||||
var result = UserFunctions[prefix][name].func.apply(null, parameters);
|
||||
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));
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -495,9 +495,6 @@ function TaskSuite () {
|
|||
|
||||
internal.wait(1);
|
||||
|
||||
var t = getTasks();
|
||||
assertEqual(0, t.length);
|
||||
|
||||
internal.wait(5);
|
||||
|
||||
assertEqual(1, db[cn].count());
|
||||
|
@ -529,17 +526,9 @@ function TaskSuite () {
|
|||
assertEqual(5, task.offset);
|
||||
assertEqual("_system", task.database);
|
||||
|
||||
var t = getTasks();
|
||||
assertEqual(1, t.length);
|
||||
|
||||
internal.wait(15);
|
||||
|
||||
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