1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/edge-index-hacks

This commit is contained in:
Simon Grätzer 2017-06-01 16:09:36 +02:00
commit 7b2306446d
7 changed files with 87 additions and 8 deletions

View File

@ -1,6 +1,8 @@
devel
-----
* issue #2515: The replace-or-with-in optimization rule might prevent use of indexes
* added `REGEX_REPLACE` AQL function
* the RocksDB storage format was changed, users of the previous alpha versions

View File

@ -64,3 +64,40 @@ FunctionEnd
!insertmacro WaitForServiceDown ""
!insertmacro WaitForServiceDown "un."
;--------------------------------
; by Anders http://forums.winamp.com/member.php?u=70852
!macro QueryServiceStatus un
Function ${un}QueryServiceStatus
StrCpy $0 0
push $0
push $0
push $0
!define /ifndef SERVICE_QUERY_STATUS 4
System::Call 'ADVAPI32::OpenSCManager(p0, p0, i1)p.r1'
${If} $1 P<> 0
System::Call 'ADVAPI32::OpenService(pr1, t"${TRI_SVC_NAME}", i${SERVICE_QUERY_STATUS})p.r2'
System::Call 'ADVAPI32::CloseServiceHandle(pr1)'
${If} $2 P<> 0
System::Call 'ADVAPI32::QueryServiceStatus(pr2, @r3)i.r0' ; Note: NSIS 3+ syntax to "allocate" a SERVICE_STATUS
${If} $0 <> 0
System::Call '*$3(i,i.r4,i,i.r5,i.r6)'
pop $0
pop $0
pop $0
push $4
push $5
push $6
DetailPrint "CurrentState=$4 Win32ExitCode=$5 ServiceSpecificExitCode=$6"
${EndIf}
System::Call 'ADVAPI32::CloseServiceHandle(pr2)'
${EndIf}
${EndIf}
FunctionEnd
!macroend
!insertmacro QueryServiceStatus ""
!insertmacro QueryServiceStatus "un."

View File

@ -496,7 +496,22 @@ System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("ARANGODB_DEFAULT_ROOT_PA
Pop $0
DetailPrint "Status: $0"
${If} $0 != "0"
MessageBox MB_OK "Waited 40 seconds for the ArangoDB service to come up; $\r$\nPlease look at $\r$\n`sc status ${TRI_SVC_NAME}` $\r$\n and the Windows Eventlog for eventual errors!"
Call QueryServiceStatus
Pop $0
Pop $1
Pop $2
!define SC_WAITED "Waited 40 seconds for the ArangoDB service to come up;"
!define SC_SV "Please look at $\r$\n`sc query ${TRI_SVC_NAME}`"
!define SC_EVLOG "and the Windows Eventlog for eventual errors!"
${If} $2 == "1"
MessageBox MB_OK "${SC_WAITED}$\r$\nbut it exited with an error; $\r$\n${SC_SV}$\r$\n${SC_EVLOG}"
${ElseIf} $2 == "2"
MessageBox MB_OK "${SC_WAITED}$\r$\nbut it exited with a fatal error; $\r$\n${SC_SV}$\r$\n${SC_EVLOG}"
${Else}
MessageBox MB_OK "${SC_WAITED}$\r$\n${SC_SV}$\r$\n${SC_EVLOG}"
${EndIf}
Abort
${EndIf}
nothing:

View File

@ -47,7 +47,7 @@ Compactor::~Compactor() {
// @brief Run
void Compactor::run () {
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Starting compator personality";
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Starting compactor personality";
CONDITION_LOCKER(guard, _cv);
@ -76,7 +76,7 @@ void Compactor::wakeUp () {
// @brief Begin shutdown
void Compactor::beginShutdown() {
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Shutting down compator personality";
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Shutting down compactor personality";
Thread::beginShutdown();

View File

@ -3128,8 +3128,9 @@ struct CommonNodeFinder {
/// @brief auxilliary struct for the OR-to-IN conversion
struct OrSimplifier {
Ast* ast;
ExecutionPlan* plan;
explicit OrSimplifier(Ast* ast) : ast(ast) {}
OrSimplifier(Ast* ast, ExecutionPlan* plan) : ast(ast), plan(plan) {}
std::string stringifyNode(AstNode const* node) const {
try {
@ -3251,6 +3252,27 @@ struct OrSimplifier {
if (detect(lhsNew, i >= 2, leftName, leftAttr, leftValue) &&
detect(rhsNew, i % 2 == 0, rightName, rightAttr, rightValue) &&
leftName == rightName) {
std::pair<Variable const*, std::vector<arangodb::basics::AttributeName>> tmp1;
if (leftValue->isAttributeAccessForVariable(tmp1)) {
bool qualifies = false;
auto setter = plan->getVarSetBy(tmp1.first->id);
if (setter != nullptr && setter->getType() == EN::ENUMERATE_COLLECTION) {
qualifies = true;
}
std::pair<Variable const*, std::vector<arangodb::basics::AttributeName>> tmp2;
if (qualifies && rightValue->isAttributeAccessForVariable(tmp2)) {
auto setter = plan->getVarSetBy(tmp2.first->id);
if (setter != nullptr && setter->getType() == EN::ENUMERATE_COLLECTION) {
if (tmp1.first != tmp2.first || tmp1.second != tmp2.second) {
continue;
}
}
}
}
return buildValues(leftAttr, leftValue,
lhsNew->type == NODE_TYPE_OPERATOR_BINARY_IN,
rightValue,
@ -3317,7 +3339,7 @@ void arangodb::aql::replaceOrWithInRule(Optimizer* opt,
auto root = cn->expression()->node();
OrSimplifier simplifier(plan->getAst());
OrSimplifier simplifier(plan->getAst(), plan.get());
auto newRoot = simplifier.simplify(root);
if (newRoot != root) {

View File

@ -127,7 +127,10 @@ bool SingleServerEdgeCursor::next(
} else {
_cache.clear();
auto cb = [&](DocumentIdentifierToken const& token) {
_cache.emplace_back(token);
if (token._data != 0) {
// Document not found
_cache.emplace_back(token);
}
};
bool tmp = cursor->next(cb, 1000);
TRI_ASSERT(tmp == cursor->hasMore());

View File

@ -351,7 +351,7 @@ function NewAqlReplaceORWithINTestSuite () {
+ " FILTER x.value == y.bb || x.value == y.cc"
+ " FILTER x.value != null SORT x.value RETURN x.value";
isRuleUsed(query, {});
ruleIsNotUsed(query, {});
var expected = [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10 ];
var actual = getQueryResults(query, {});
@ -434,7 +434,7 @@ function NewAqlReplaceORWithINTestSuite () {
var query = "LET x = NOOPT({a:1}) FOR v IN " + replace.name()
+ " FILTER x.a == v.value || x.a == v._key RETURN v._key";
isRuleUsed(query, {});
ruleIsNotUsed(query, {});
},
testDudAlwaysTrue: function () {