1
0
Fork 0

attempt to fix broken graph stuff

This commit is contained in:
jsteemann 2017-04-20 22:14:30 +02:00
parent f5009099cf
commit 2994988210
4 changed files with 22 additions and 14 deletions

View File

@ -71,7 +71,7 @@ GraphNode::GraphNode(ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
_tmpObjVarNode(_plan->getAst()->createNodeReference(_tmpObjVariable)),
_tmpIdNode(_plan->getAst()->createNodeValueString("", 0)),
_options(std::move(options)),
_optionsBuild(false),
_optionsBuilt(false),
_isSmart(false) {
TRI_ASSERT(_vocbase != nullptr);
TRI_ASSERT(_options != nullptr);
@ -263,7 +263,7 @@ GraphNode::GraphNode(ExecutionPlan* plan,
_tmpObjVarNode(nullptr),
_tmpIdNode(nullptr),
_options(nullptr),
_optionsBuild(false),
_optionsBuilt(false),
_isSmart(false) {
// Directions
VPackSlice dirList = base.get("directions");
@ -387,7 +387,7 @@ GraphNode::GraphNode(
_tmpIdNode(_plan->getAst()->createNodeValueString("", 0)),
_directions(directions),
_options(std::move(options)),
_optionsBuild(false),
_optionsBuilt(false),
_isSmart(false) {
_graphInfo.openArray();
for (auto& it : edgeColls) {

View File

@ -171,7 +171,7 @@ class GraphNode : public ExecutionNode {
/// @brief Pseudo string value node to hold the last visted vertex id.
/// @brief Flag if the options have been build.
/// Afterwards this class is not copyable anymore.
bool _optionsBuild;
bool _optionsBuilt;
/// @brief The list of traverser engines grouped by server.
std::unordered_map<ServerID, traverser::TraverserEngineID> _engines;

View File

@ -259,7 +259,7 @@ void ShortestPathNode::toVelocyPackHelper(VPackBuilder& nodes,
ExecutionNode* ShortestPathNode::clone(ExecutionPlan* plan,
bool withDependencies,
bool withProperties) const {
TRI_ASSERT(!_optionsBuild);
TRI_ASSERT(!_optionsBuilt);
auto oldOpts = static_cast<ShortestPathOptions*>(options());
std::unique_ptr<BaseOptions> tmp =
std::make_unique<ShortestPathOptions>(*oldOpts);
@ -307,10 +307,10 @@ double ShortestPathNode::estimateCost(size_t& nrItems) const {
}
void ShortestPathNode::prepareOptions() {
if (_optionsBuild) {
if (_optionsBuilt) {
return;
}
TRI_ASSERT(!_optionsBuild);
TRI_ASSERT(!_optionsBuilt);
size_t numEdgeColls = _edgeColls.size();
Ast* ast = _plan->getAst();
@ -343,6 +343,10 @@ void ShortestPathNode::prepareOptions() {
}
// If we use the path output the cache should activate document
// caching otherwise it is not worth it.
_options->activateCache(false, engines());
_optionsBuild = true;
if (ServerState::instance()->isCoordinator()) {
_options->activateCache(false, engines());
} else {
_options->activateCache(false, nullptr);
}
_optionsBuilt = true;
}

View File

@ -386,7 +386,7 @@ void TraversalNode::toVelocyPackHelper(arangodb::velocypack::Builder& nodes,
/// @brief clone ExecutionNode recursively
ExecutionNode* TraversalNode::clone(ExecutionPlan* plan, bool withDependencies,
bool withProperties) const {
TRI_ASSERT(!_optionsBuild);
TRI_ASSERT(!_optionsBuilt);
auto oldOpts = static_cast<TraverserOptions*>(options());
std::unique_ptr<BaseOptions> tmp =
std::make_unique<TraverserOptions>(*oldOpts);
@ -475,10 +475,10 @@ double TraversalNode::estimateCost(size_t& nrItems) const {
}
void TraversalNode::prepareOptions() {
if (_optionsBuild) {
if (_optionsBuilt) {
return;
}
TRI_ASSERT(!_optionsBuild);
TRI_ASSERT(!_optionsBuilt);
_options->setVariable(_tmpObjVariable);
size_t numEdgeColls = _edgeColls.size();
@ -563,8 +563,12 @@ void TraversalNode::prepareOptions() {
}
// If we use the path output the cache should activate document
// caching otherwise it is not worth it.
_options->activateCache(false, engines());
_optionsBuild = true;
if (ServerState::instance()->isCoordinator()) {
_options->activateCache(false, engines());
} else {
_options->activateCache(false, nullptr);
}
_optionsBuilt = true;
}
/// @brief remember the condition to execute for early traversal abortion.