diff --git a/arangod/Aql/Ast.cpp b/arangod/Aql/Ast.cpp index c9304edf4c..e7167acf6d 100644 --- a/arangod/Aql/Ast.cpp +++ b/arangod/Aql/Ast.cpp @@ -3258,7 +3258,7 @@ AstNode* Ast::traverseAndModify( AstNode* result = traverseAndModify(member, preVisitor, visitor, postVisitor, data); - if (result != node) { + if (result != member) { TRI_ASSERT(node != nullptr); node->changeMember(i, result); } @@ -3271,6 +3271,7 @@ AstNode* Ast::traverseAndModify( } /// @brief traverse the AST, using a depth-first visitor +/// Note that the starting node is not replaced! AstNode* Ast::traverseAndModify( AstNode* node, std::function visitor, void* data) { @@ -3286,7 +3287,7 @@ AstNode* Ast::traverseAndModify( if (member != nullptr) { AstNode* result = traverseAndModify(member, visitor, data); - if (result != node) { + if (result != member) { node->changeMember(i, result); } } diff --git a/arangod/Aql/OptimizerRules.cpp b/arangod/Aql/OptimizerRules.cpp index a793defc7c..cae9452f79 100644 --- a/arangod/Aql/OptimizerRules.cpp +++ b/arangod/Aql/OptimizerRules.cpp @@ -4141,6 +4141,8 @@ AstNode* isValueOrRefNode(AstNode* node) { return node; } +// contains the AstNode* distanceNode a distance function? +// if so return a valid GeoIndexInfo object GeoIndexInfo isDistanceFunction(AstNode* distanceNode, AstNode* expressionParent) { // the expression must exist and it must be a function call @@ -4163,6 +4165,9 @@ GeoIndexInfo isDistanceFunction(AstNode* distanceNode, return rv; } + +// checks if a node contanis a geo index function a valid operator to from +// a filter condition! GeoIndexInfo isGeoFilterExpression(AstNode* node, AstNode* expressionParent) { // binary compare must be on top bool dist_first = true; @@ -4492,7 +4497,11 @@ void replaceGeoCondition(ExecutionPlan* plan, GeoIndexInfo& info) { plan->replaceNode(info.setter, newNode); bool done = false; - ast->traverseAndModify( + + // Modifies the node in the following way: checks if a binary and node has + // a child that is a filter condition. if so it replaces the node with the + // other child effectively deleting the filter condition. + AstNode* modified = ast->traverseAndModify( newNode->expression()->nodeForModification(), [&done](AstNode* node, void* data) { if (done) { @@ -4502,6 +4511,7 @@ void replaceGeoCondition(ExecutionPlan* plan, GeoIndexInfo& info) { for (std::size_t i = 0; i < node->numMembers(); i++) { if (isGeoFilterExpression(node->getMemberUnchecked(i), node)) { done = true; + //select the other node - not the member containing the error message return node->getMemberUnchecked(i ? 0 : 1); } } @@ -4510,6 +4520,10 @@ void replaceGeoCondition(ExecutionPlan* plan, GeoIndexInfo& info) { }, nullptr); + if (modified != newNode->expression()->node()){ + newNode->expression()->replaceNode(modified); + } + if (done) { return; } @@ -4517,15 +4531,14 @@ void replaceGeoCondition(ExecutionPlan* plan, GeoIndexInfo& info) { auto replaceInfo = iterativePreorderWithCondition( EN::FILTER, newNode->expression()->nodeForModification(), &isGeoFilterExpression); + if (newNode->expression()->nodeForModification() == replaceInfo.expressionParent) { if (replaceInfo.expressionParent->type == NODE_TYPE_OPERATOR_BINARY_AND) { for (std::size_t i = 0; i < replaceInfo.expressionParent->numMembers(); ++i) { - if (replaceInfo.expressionParent->getMember(i) != - replaceInfo.expressionNode) { - newNode->expression()->replaceNode( - replaceInfo.expressionParent->getMember(i)); + if (replaceInfo.expressionParent->getMember(i) != replaceInfo.expressionNode) { + newNode->expression()->replaceNode( replaceInfo.expressionParent->getMember(i)); return; } } @@ -4537,7 +4550,7 @@ void replaceGeoCondition(ExecutionPlan* plan, GeoIndexInfo& info) { // if(replaceInfo.expressionParent->type == NODE_TYPE_OPERATOR_BINARY_AND){ // // delete ast node - we would need the parent of expression parent to // delete the node - // // we do not have it available here so we just replace the the node + // // we do not have it available here so we just replace the node // with true return; // } //} diff --git a/scripts/tmux_starter b/scripts/tmux_starter index 884cf6fa56..6528b22a55 100755 --- a/scripts/tmux_starter +++ b/scripts/tmux_starter @@ -33,18 +33,21 @@ suite_all(){ local count="$1" shift 1 local args="$@" - local args_default=( ) + local args_default=( '--cluster' 'false' ) local tests="" case $count in num) - echo "11" + echo "12" return ;; name) echo "test_all" return ;; + delay) + return + ;; 0) echo "./scripts/quickieTest.sh ${args[@]} && exit 0" return @@ -56,27 +59,30 @@ suite_all(){ tests="shell_client" ;; 3) - tests="shell_server_aql" + tests="shell_server_aql --testBuckets 2/0" ;; 4) - tests="http_server" + tests="shell_server_aql --testBuckets 2/1" ;; 5) - tests="server_http" + tests="http_server" ;; 6) - tests="dump importing" + tests="server_http" ;; 7) - tests="export arangobench upgrade" + tests="dump importing" ;; 8) - tests="replication_sync replication_static" + tests="export arangobench upgrade" ;; 9) - tests="replication_ongoing http_replication shell_replication" + tests="replication_sync replication_static" ;; 10) + tests="replication_ongoing http_replication shell_replication" + ;; + 11) tests="agency cluster_sync" ;; *) @@ -85,6 +91,126 @@ suite_all(){ echo "./scripts/unittest $tests ${args_default[@]} ${args[@]} && exit 0" } +portrange() { + local count="$1" + local portStart=1240 + local portOffset=20 + echo "--minPort $(( portStart + count * portOffset )) --maxPort $(( portStart + (count + 1) * portOffset - 1))" +} + +## suite_all_cluster(){ +## local count="$1" +## shift 1 +## local args="$@" +## local args_default=( '--cluster' 'true' ) +## +## local tests="" +## case $count in +## num) +## echo "12" +## return +## ;; +## name) +## echo "test_all_cluster" +## return +## ;; +## delay) +## echo "10" +## return +## ;; +## 0) +## echo "./scripts/quickieTest.sh ${args[@]} && exit 0" +## return +## ;; +## 1) +## tests="shell_server $(portrange $count)" +## ;; +## 2) +## tests="shell_client $(portrange $count)" +## ;; +## 3) +## tests="shell_server_aql --testBuckets 3/0 $(portrange $count)" +## ;; +## 4) +## tests="shell_server_aql --testBuckets 3/1 $(portrange $count)" +## ;; +## 5) +## tests="shell_server_aql --testBuckets 3/2 $(portrange $count)" +## ;; +## 6) +## tests="http_server $(portrange $count)" +## ;; +## 7) +## tests="ssl_server $(portrange $count)" +## ;; +## 8) +## tests="server_http $(portrange $count)" +## ;; +## 9) +## tests="dump $(portrange $count)" +## ;; +## 10) +## tests="agency $(portrange $count)" +## ;; +## 11) +## tests="resilience $(portrange $count)" +## ;; +## *) +## echo "exit 0" +## return +## esac +## +## echo "./scripts/unittest $tests ${args_default[@]} ${args[@]} && exit 0" +## } + + +suite_all_cluster(){ + local count="$1" + shift 1 + local args="$@" + local args_default=( '--cluster' 'true' ) + + local tests="" + case $count in + num) + echo "6" + return + ;; + name) + echo "test_all_cluster" + return + ;; + delay) + echo "10" + return + ;; + 0) + echo "./scripts/quickieTest.sh ${args[@]} && exit 0" + return + ;; + 1) + tests="shell_server $(portrange $count)" + ;; + 2) + tests="shell_client $(portrange $count)" + ;; + 3) + tests="shell_server_aql $(portrange $count)" + ;; + 4) + tests="http_server ssl_server server_http $(portrange $count)" + ;; + 5) + tests="dump agency resilience $(portrange $count)" + ;; + *) + echo "exit 0" + return + esac + + echo "./scripts/unittest $tests ${args_default[@]} ${args[@]} && exit 0" +} + suite_all_rocksdb(){ local count="$1" shift 1 @@ -101,6 +227,21 @@ suite_all_rocksdb(){ esac } +suite_all_rocksdb_cluster(){ + local count="$1" + shift 1 + local args="$@" + + case $count in + name) + echo "test_all_rocksdb_cluster" + return + ;; + *) + suite_all_cluster "$count" "--storageEngine rocksdb" "${args[@]}" + ;; + esac +} # tmux kill_old_session(){ local session_name="$1" @@ -148,9 +289,15 @@ execute_tasks(){ shift 2 local args="$@" local count=0 + local delay="" + delay="$($tasks 'delay')" while (( count < $($tasks 'num') )); do local exec_cmd="$($tasks $count "${args[@]}")" echo "running: ${exec_cmd[@]}" + if [[ -n "$delay" ]]; then + echo "sleep for $delay" + sleep "$delay" + fi tmux send-keys -t $session_name.$count "${exec_cmd[@]}" Enter (( count++ )) done