1
0
Fork 0

fixing distribute in cluster optimizer rule.

This commit is contained in:
James 2014-10-21 11:04:38 +01:00
parent 12ac3b8bdd
commit dc357b96bf
1 changed files with 17 additions and 9 deletions

View File

@ -1638,14 +1638,11 @@ int triagens::aql::scatterInCluster (Optimizer* opt,
auto parents = node->getParents();
auto deps = node->getDependencies();
TRI_ASSERT(deps.size() == 1);
// unlink the node
bool const isRootNode = plan->isRoot(node);
if (isRootNode) {
if (deps[0]->getType() == ExecutionNode::REMOTE &&
deps[0]->getDependencies()[0]->getType() == ExecutionNode::DISTRIBUTE){
continue;
}
// don't do this if we are already distributing!
if (deps[0]->getType() == ExecutionNode::REMOTE &&
deps[0]->getDependencies()[0]->getType() == ExecutionNode::DISTRIBUTE){
continue;
}
plan->unlinkNode(node, isRootNode);
@ -1782,8 +1779,19 @@ int triagens::aql::distributeInCluster (Optimizer* opt,
// re-link with the remote node
node->addDependency(remoteNode);
// make node the root again
plan->root(node);
// insert another remote node
remoteNode = new RemoteNode(plan, plan->nextId(), vocbase, collection, "", "", "");
plan->registerNode(remoteNode);
remoteNode->addDependency(node);
// insert a gather node
ExecutionNode* gatherNode = new GatherNode(plan, plan->nextId(), vocbase,
collection);
plan->registerNode(gatherNode);
gatherNode->addDependency(remoteNode);
// we replaced the root node, set a new root node
plan->root(gatherNode);
wasModified = true;
}