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;
|
||||
}
|
||||
|
||||
bool runOnlyRequiredRules = false;
|
||||
int leastDoneLevel = 0;
|
||||
|
||||
TRI_ASSERT(! _rules.empty());
|
||||
|
@ -169,9 +170,10 @@ int Optimizer::createPlans (ExecutionPlan* plan,
|
|||
*/
|
||||
|
||||
level = (*it).first;
|
||||
if (disabledIds.find(level) != disabledIds.end() &&
|
||||
if ((runOnlyRequiredRules || disabledIds.find(level) != disabledIds.end()) &&
|
||||
(*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;
|
||||
|
||||
_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;
|
||||
|
||||
// Stop if the result gets out of hand:
|
||||
if (_plans.size() >= _maxNumberOfPlans) {
|
||||
// TODO: must iterate over all REQUIRED remaining transformation rules
|
||||
if (! runOnlyRequiredRules &&
|
||||
_plans.size() >= _maxNumberOfPlans) {
|
||||
// must still iterate over all REQUIRED remaining transformation rules
|
||||
// because there are some rules which are required to make the query
|
||||
// work in cluster mode
|
||||
// rules that have their canBeDisabled flag set to false must still
|
||||
// be carried out!
|
||||
break;
|
||||
runOnlyRequiredRules = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,9 @@ using namespace triagens::aql;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
V8Expression::V8Expression (v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Function> func)
|
||||
v8::Persistent<v8::Function> func)
|
||||
: isolate(isolate),
|
||||
func(func) {
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -76,8 +75,8 @@ AqlValue V8Expression::execute (triagens::arango::AqlTransaction* trx,
|
|||
size_t const n = vars.size();
|
||||
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();
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
auto varname = vars[i]->name;
|
||||
auto reg = regs[i];
|
||||
|
|
|
@ -82,10 +82,18 @@ namespace triagens {
|
|||
// --SECTION-- public variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
v8::Isolate* isolate;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief the isolate used when executing and destroying the expression
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 thisRuleEnabled = { optimizer: { rules: [ "-all", "+" + ruleName ] } };
|
||||
var thisRuleDisabled = { optimizer: { rules: [ "+all", "-" + ruleName ] } };
|
||||
var maxPlans = { optimizer: { rules: [ "-all" ] }, maxNumberOfPlans: 1 };
|
||||
|
||||
var cn1 = "UnitTestsAqlOptimizerRuleUndist1";
|
||||
var cn2 = "UnitTestsAqlOptimizerRuleUndist2";
|
||||
|
@ -79,6 +80,43 @@ function optimizerRuleTestSuite () {
|
|||
db._drop(cn1);
|
||||
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
|
||||
|
@ -100,7 +138,6 @@ function optimizerRuleTestSuite () {
|
|||
[
|
||||
"distribute-in-cluster",
|
||||
"scatter-in-cluster",
|
||||
"distribute-filtercalc-to-cluster"
|
||||
],
|
||||
[
|
||||
"distribute-in-cluster",
|
||||
|
@ -109,7 +146,6 @@ function optimizerRuleTestSuite () {
|
|||
[
|
||||
"distribute-in-cluster",
|
||||
"scatter-in-cluster",
|
||||
"distribute-filtercalc-to-cluster"
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -132,9 +168,9 @@ function optimizerRuleTestSuite () {
|
|||
"ScatterNode",
|
||||
"RemoteNode",
|
||||
"EnumerateCollectionNode",
|
||||
"CalculationNode",
|
||||
"RemoteNode",
|
||||
"GatherNode",
|
||||
"CalculationNode",
|
||||
"DistributeNode",
|
||||
"RemoteNode",
|
||||
"RemoveNode",
|
||||
|
@ -159,9 +195,9 @@ function optimizerRuleTestSuite () {
|
|||
"ScatterNode",
|
||||
"RemoteNode",
|
||||
"EnumerateCollectionNode",
|
||||
"CalculationNode",
|
||||
"RemoteNode",
|
||||
"GatherNode",
|
||||
"CalculationNode",
|
||||
"DistributeNode",
|
||||
"RemoteNode",
|
||||
"InsertNode",
|
||||
|
@ -375,7 +411,6 @@ function optimizerRuleTestSuite () {
|
|||
[
|
||||
"distribute-in-cluster",
|
||||
"scatter-in-cluster",
|
||||
"distribute-filtercalc-to-cluster",
|
||||
],
|
||||
[
|
||||
"distribute-in-cluster",
|
||||
|
@ -384,7 +419,6 @@ function optimizerRuleTestSuite () {
|
|||
[
|
||||
"distribute-in-cluster",
|
||||
"scatter-in-cluster",
|
||||
"distribute-filtercalc-to-cluster",
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -407,9 +441,9 @@ function optimizerRuleTestSuite () {
|
|||
"ScatterNode",
|
||||
"RemoteNode",
|
||||
"EnumerateCollectionNode",
|
||||
"CalculationNode",
|
||||
"RemoteNode",
|
||||
"GatherNode",
|
||||
"CalculationNode",
|
||||
"DistributeNode",
|
||||
"RemoteNode",
|
||||
"RemoveNode",
|
||||
|
@ -434,9 +468,9 @@ function optimizerRuleTestSuite () {
|
|||
"ScatterNode",
|
||||
"RemoteNode",
|
||||
"EnumerateCollectionNode",
|
||||
"CalculationNode",
|
||||
"RemoteNode",
|
||||
"GatherNode",
|
||||
"CalculationNode",
|
||||
"DistributeNode",
|
||||
"RemoteNode",
|
||||
"InsertNode",
|
||||
|
|
|
@ -44,6 +44,11 @@ AC_MSG_NOTICE([CXXFLAGS: ${CXXFLAGS}])
|
|||
AC_MSG_NOTICE([LDFLAGS: ${LDFLAGS}])
|
||||
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
|
||||
if test "x$a" != "x"; then
|
||||
AC_MSG_NOTICE([$[]a])
|
||||
|
|
Loading…
Reference in New Issue