mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
a3265b7fd4
|
@ -117,6 +117,7 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool runOnlyRequiredRules = false;
|
||||||
int leastDoneLevel = 0;
|
int leastDoneLevel = 0;
|
||||||
|
|
||||||
TRI_ASSERT(! _rules.empty());
|
TRI_ASSERT(! _rules.empty());
|
||||||
|
@ -169,9 +170,10 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
level = (*it).first;
|
level = (*it).first;
|
||||||
if (disabledIds.find(level) != disabledIds.end() &&
|
if ((runOnlyRequiredRules || disabledIds.find(level) != disabledIds.end()) &&
|
||||||
(*it).second.canBeDisabled) {
|
(*it).second.canBeDisabled) {
|
||||||
// we picked a disabled rule
|
// we picked a disabled rule or we have reached the max number of plans
|
||||||
|
// and just skip this rule
|
||||||
level = it->first;
|
level = it->first;
|
||||||
|
|
||||||
_newPlans.push_back(p, level); // nothing to do, just keep it
|
_newPlans.push_back(p, level); // nothing to do, just keep it
|
||||||
|
@ -210,13 +212,12 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
||||||
// std::cout << "Least done level is " << leastDoneLevel << std::endl;
|
// std::cout << "Least done level is " << leastDoneLevel << std::endl;
|
||||||
|
|
||||||
// Stop if the result gets out of hand:
|
// Stop if the result gets out of hand:
|
||||||
if (_plans.size() >= _maxNumberOfPlans) {
|
if (! runOnlyRequiredRules &&
|
||||||
// TODO: must iterate over all REQUIRED remaining transformation rules
|
_plans.size() >= _maxNumberOfPlans) {
|
||||||
|
// must still iterate over all REQUIRED remaining transformation rules
|
||||||
// because there are some rules which are required to make the query
|
// because there are some rules which are required to make the query
|
||||||
// work in cluster mode
|
// work in cluster mode
|
||||||
// rules that have their canBeDisabled flag set to false must still
|
runOnlyRequiredRules = true;
|
||||||
// be carried out!
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ V8Expression::V8Expression (v8::Isolate* isolate,
|
||||||
v8::Persistent<v8::Function> func)
|
v8::Persistent<v8::Function> func)
|
||||||
: isolate(isolate),
|
: isolate(isolate),
|
||||||
func(func) {
|
func(func) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -76,8 +75,8 @@ AqlValue V8Expression::execute (triagens::arango::AqlTransaction* trx,
|
||||||
size_t const n = vars.size();
|
size_t const n = vars.size();
|
||||||
TRI_ASSERT(regs.size() == n); // assert same vector length
|
TRI_ASSERT(regs.size() == n); // assert same vector length
|
||||||
|
|
||||||
// TODO: only convert those variables to V8 that are actually used in the expression
|
|
||||||
v8::Handle<v8::Object> values = v8::Object::New();
|
v8::Handle<v8::Object> values = v8::Object::New();
|
||||||
|
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
auto varname = vars[i]->name;
|
auto varname = vars[i]->name;
|
||||||
auto reg = regs[i];
|
auto reg = regs[i];
|
||||||
|
|
|
@ -82,8 +82,16 @@ namespace triagens {
|
||||||
// --SECTION-- public variables
|
// --SECTION-- public variables
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief the isolate used when executing and destroying the expression
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
v8::Isolate* isolate;
|
v8::Isolate* isolate;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief the compiled expression as a V8 function
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
v8::Persistent<v8::Function> func;
|
v8::Persistent<v8::Function> func;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,6 +43,7 @@ function optimizerRuleTestSuite () {
|
||||||
var rulesAll = { optimizer: { rules: [ "+all" ] } };
|
var rulesAll = { optimizer: { rules: [ "+all" ] } };
|
||||||
var thisRuleEnabled = { optimizer: { rules: [ "-all", "+" + ruleName ] } };
|
var thisRuleEnabled = { optimizer: { rules: [ "-all", "+" + ruleName ] } };
|
||||||
var thisRuleDisabled = { optimizer: { rules: [ "+all", "-" + ruleName ] } };
|
var thisRuleDisabled = { optimizer: { rules: [ "+all", "-" + ruleName ] } };
|
||||||
|
var maxPlans = { optimizer: { rules: [ "-all" ] }, maxNumberOfPlans: 1 };
|
||||||
|
|
||||||
var cn1 = "UnitTestsAqlOptimizerRuleUndist1";
|
var cn1 = "UnitTestsAqlOptimizerRuleUndist1";
|
||||||
var cn2 = "UnitTestsAqlOptimizerRuleUndist2";
|
var cn2 = "UnitTestsAqlOptimizerRuleUndist2";
|
||||||
|
@ -80,6 +81,43 @@ function optimizerRuleTestSuite () {
|
||||||
db._drop(cn2);
|
db._drop(cn2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test that the rules fire even if the max number of plans is reached
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testThisRuleEnabledMaxNumberOfPlans : function () {
|
||||||
|
var queries = [
|
||||||
|
"FOR d IN " + cn1 + " REMOVE d in " + cn1,
|
||||||
|
"FOR d IN " + cn1 + " REMOVE d._key in " + cn1,
|
||||||
|
"FOR d IN " + cn1 + " INSERT d in " + cn2,
|
||||||
|
"FOR d IN " + cn1 + " INSERT d._key in " + cn2
|
||||||
|
];
|
||||||
|
|
||||||
|
var expectedRules = [
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"distribute-in-cluster",
|
||||||
|
"scatter-in-cluster"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
queries.forEach(function(query, i) {
|
||||||
|
var result = AQL_EXPLAIN(query, { }, maxPlans);
|
||||||
|
assertEqual(expectedRules[i], result.plan.rules, query);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test that the rule fires when it is enabled
|
/// @brief test that the rule fires when it is enabled
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -100,7 +138,6 @@ function optimizerRuleTestSuite () {
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
"distribute-filtercalc-to-cluster"
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
|
@ -109,7 +146,6 @@ function optimizerRuleTestSuite () {
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
"distribute-filtercalc-to-cluster"
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -132,9 +168,9 @@ function optimizerRuleTestSuite () {
|
||||||
"ScatterNode",
|
"ScatterNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"EnumerateCollectionNode",
|
"EnumerateCollectionNode",
|
||||||
"CalculationNode",
|
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
|
"CalculationNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"RemoveNode",
|
"RemoveNode",
|
||||||
|
@ -159,9 +195,9 @@ function optimizerRuleTestSuite () {
|
||||||
"ScatterNode",
|
"ScatterNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"EnumerateCollectionNode",
|
"EnumerateCollectionNode",
|
||||||
"CalculationNode",
|
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
|
"CalculationNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"InsertNode",
|
"InsertNode",
|
||||||
|
@ -375,7 +411,6 @@ function optimizerRuleTestSuite () {
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
"distribute-filtercalc-to-cluster",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
|
@ -384,7 +419,6 @@ function optimizerRuleTestSuite () {
|
||||||
[
|
[
|
||||||
"distribute-in-cluster",
|
"distribute-in-cluster",
|
||||||
"scatter-in-cluster",
|
"scatter-in-cluster",
|
||||||
"distribute-filtercalc-to-cluster",
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -407,9 +441,9 @@ function optimizerRuleTestSuite () {
|
||||||
"ScatterNode",
|
"ScatterNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"EnumerateCollectionNode",
|
"EnumerateCollectionNode",
|
||||||
"CalculationNode",
|
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
|
"CalculationNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"RemoveNode",
|
"RemoveNode",
|
||||||
|
@ -434,9 +468,9 @@ function optimizerRuleTestSuite () {
|
||||||
"ScatterNode",
|
"ScatterNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"EnumerateCollectionNode",
|
"EnumerateCollectionNode",
|
||||||
"CalculationNode",
|
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"GatherNode",
|
"GatherNode",
|
||||||
|
"CalculationNode",
|
||||||
"DistributeNode",
|
"DistributeNode",
|
||||||
"RemoteNode",
|
"RemoteNode",
|
||||||
"InsertNode",
|
"InsertNode",
|
||||||
|
|
|
@ -44,6 +44,11 @@ AC_MSG_NOTICE([CXXFLAGS: ${CXXFLAGS}])
|
||||||
AC_MSG_NOTICE([LDFLAGS: ${LDFLAGS}])
|
AC_MSG_NOTICE([LDFLAGS: ${LDFLAGS}])
|
||||||
AC_MSG_NOTICE([LIBS: ${LIBS}])
|
AC_MSG_NOTICE([LIBS: ${LIBS}])
|
||||||
|
|
||||||
|
CC_VERSION=`${CC} --version 2>&1`
|
||||||
|
AC_MSG_NOTICE([CC: ${CC_VERSION}])
|
||||||
|
CXX_VERSION=`${CXX} --version 2>&1`
|
||||||
|
AC_MSG_NOTICE([CXX: ${CXX_VERSION}])
|
||||||
|
|
||||||
echo $FLAG_INFO | tr "|" "\n" | while read a; do
|
echo $FLAG_INFO | tr "|" "\n" | while read a; do
|
||||||
if test "x$a" != "x"; then
|
if test "x$a" != "x"; then
|
||||||
AC_MSG_NOTICE([$[]a])
|
AC_MSG_NOTICE([$[]a])
|
||||||
|
|
Loading…
Reference in New Issue