mirror of https://gitee.com/bigwinds/arangodb
Fixed invalid traversal optimization if vertex is not existing but filter would let null pass
This commit is contained in:
parent
07e1bac837
commit
9495117238
|
@ -777,8 +777,14 @@ Json* SingleServerTraversalPath::vertexToJson (Transaction* trx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRI_doc_mptr_copy_t mptr;
|
TRI_doc_mptr_copy_t mptr;
|
||||||
trx->readSingle(collection, &mptr, v.key);
|
int res = trx->readSingle(collection, &mptr, v.key);
|
||||||
++_readDocuments;
|
++_readDocuments;
|
||||||
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
if (res == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
|
||||||
|
return new Json(Json::Null);
|
||||||
|
}
|
||||||
|
THROW_ARANGO_EXCEPTION(res);
|
||||||
|
}
|
||||||
return new Json(TRI_ExpandShapedJson(
|
return new Json(TRI_ExpandShapedJson(
|
||||||
collection->_collection->_collection->getShaper(),
|
collection->_collection->_collection->getShaper(),
|
||||||
resolver,
|
resolver,
|
||||||
|
@ -849,8 +855,22 @@ bool DepthFirstTraverser::vertexMatchesConditions (VertexId const& v, size_t dep
|
||||||
int res = _trx->readSingle(collection, &mptr, v.key);
|
int res = _trx->readSingle(collection, &mptr, v.key);
|
||||||
++_readDocuments;
|
++_readDocuments;
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
// Vertex does not exist. Do not try filter
|
if (res == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
|
||||||
return false;
|
// Vertex does not exist. Do not try filter
|
||||||
|
triagens::basics::Json tmp(triagens::basics::Json::Null);
|
||||||
|
// This needs a different check method now.
|
||||||
|
// Innerloop here
|
||||||
|
for (auto const& exp2 : it->second) {
|
||||||
|
if (! exp2->isEdgeAccess) {
|
||||||
|
if (! exp2->matchesCheck(tmp.json())) {
|
||||||
|
++_filteredPaths;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
THROW_ARANGO_EXCEPTION(res);
|
||||||
}
|
}
|
||||||
docCol = collection->_collection->_collection;
|
docCol = collection->_collection->_collection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "Traverser.h"
|
#include "Traverser.h"
|
||||||
#include "Basics/json-utilities.h"
|
#include "Basics/json-utilities.h"
|
||||||
#include "VocBase/KeyGenerator.h"
|
#include "VocBase/KeyGenerator.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using TraverserExpression = triagens::arango::traverser::TraverserExpression;
|
using TraverserExpression = triagens::arango::traverser::TraverserExpression;
|
||||||
|
|
||||||
|
@ -153,11 +152,11 @@ bool TraverserExpression::recursiveCheck (triagens::aql::AstNode const* node,
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool TraverserExpression::matchesCheck (DocumentAccessor& accessor) const {
|
bool TraverserExpression::matchesCheck (DocumentAccessor& accessor) const {
|
||||||
if (! recursiveCheck(varAccess, accessor)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
triagens::basics::Json result = accessor.toJson();
|
triagens::basics::Json result(triagens::basics::Json::Null);
|
||||||
|
if (recursiveCheck(varAccess, accessor)) {
|
||||||
|
result = accessor.toJson();
|
||||||
|
}
|
||||||
|
|
||||||
TRI_ASSERT(compareTo != nullptr);
|
TRI_ASSERT(compareTo != nullptr);
|
||||||
TRI_ASSERT(compareTo->json() != nullptr);
|
TRI_ASSERT(compareTo->json() != nullptr);
|
||||||
|
|
Loading…
Reference in New Issue