mirror of https://gitee.com/bigwinds/arangodb
fixing distribute in cluster optimizer rule.
This commit is contained in:
parent
12ac3b8bdd
commit
dc357b96bf
|
@ -1638,15 +1638,12 @@ int triagens::aql::scatterInCluster (Optimizer* opt,
|
||||||
auto parents = node->getParents();
|
auto parents = node->getParents();
|
||||||
auto deps = node->getDependencies();
|
auto deps = node->getDependencies();
|
||||||
TRI_ASSERT(deps.size() == 1);
|
TRI_ASSERT(deps.size() == 1);
|
||||||
|
|
||||||
// unlink the node
|
|
||||||
bool const isRootNode = plan->isRoot(node);
|
bool const isRootNode = plan->isRoot(node);
|
||||||
if (isRootNode) {
|
// don't do this if we are already distributing!
|
||||||
if (deps[0]->getType() == ExecutionNode::REMOTE &&
|
if (deps[0]->getType() == ExecutionNode::REMOTE &&
|
||||||
deps[0]->getDependencies()[0]->getType() == ExecutionNode::DISTRIBUTE){
|
deps[0]->getDependencies()[0]->getType() == ExecutionNode::DISTRIBUTE){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
plan->unlinkNode(node, isRootNode);
|
plan->unlinkNode(node, isRootNode);
|
||||||
|
|
||||||
auto const nodeType = node->getType();
|
auto const nodeType = node->getType();
|
||||||
|
@ -1782,8 +1779,19 @@ int triagens::aql::distributeInCluster (Optimizer* opt,
|
||||||
// re-link with the remote node
|
// re-link with the remote node
|
||||||
node->addDependency(remoteNode);
|
node->addDependency(remoteNode);
|
||||||
|
|
||||||
// make node the root again
|
// insert another remote node
|
||||||
plan->root(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;
|
wasModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue