8000 Feature/hybrid smart graph testsuite extended by hkernbach · Pull Request #14432 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/hybrid smart graph testsuite extended #14432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
780a86c
Added Protected default constructor for Valdiators
mchacki Apr 20, 2021
b246d14
Make createKey constant
mchacki Apr 22, 2021
56bf5ef
Prepare to use an internal Validator that is not user-modifyable. Thi…
mchacki Apr 22, 2021
579230b
Make setIntenralValidator a public method so we can actually call it …
mchacki Apr 22, 2021
1a74899
todo
hkernbach Apr 22, 2021
4231ca4
add satellites to GraphNode v2
hkernbach Apr 22, 2021
8958c0b
add satellites to shard locking
hkernbach Apr 22, 2021
594b916
typo
hkernbach Apr 22, 2021
29479d0
added comments to some methods
hkernbach Apr 23, 2021
1eec739
adjusted shard locking
hkernbach Apr 23, 2021
663e6a2
extended getAllLocalShards
hkernbach Apr 23, 2021
f751a6c
remove not needed methods
hkernbach Apr 23, 2021
b6390d9
Add a place to inject internal Schema validation, used e.g. to valida…
mchacki Apr 26, 2021
3208a80
Merge remote-tracking branch 'origin' into feature/use-validators-on-…
mchacki Apr 26, 2021
eaca7ce
Disabled enterprise Validator Factory
mchacki Apr 27, 2021
5113205
Removed ValidatorFactory, we do it in a different way
mchacki Apr 27, 2021
b113a36
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach Apr 28, 2021
0c90d99
Merge branch 'feature/use-validators-on-smart-edge-collections' of gi…
hkernbach Apr 28, 2021
63f4ed2
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach May 4, 2021
d869fa2
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach May 4, 2021
f97e342
Added more template instanciations
mchacki May 5, 2021
c01bec8
Make collection to shard map a map of string -> vector<string>, requi…
mchacki May 5, 2021
cb9f78f
changed api of getNextPath, not modifying builder but returning PathR…
hkernbach May 5, 2021
add77c8
First draft of toSchreierEntry for HTTP transport. This is a hacky va…
mchacki May 6, 2021
dce04f4
Simplified SingleProviderPathResult and EdgeDocument token.
mchacki May 6, 2021
532ad82
typo, adjusted format for first step in schreier format
hkernbach May 7, 2021
0eb70ef
tmp enable smartSearchNew for testing
hkernbach May 7, 2021
877a6a7
add start/reset depth parameter, default is 0
hkernbach May 10, 2021
220aa99
added dfspathfinder path_loop test
hkernbach May 10, 2021
09337ed
added dfspathfinder triangle_loop test
hkernbach May 10, 2021
86360fe
added dfspathfinder triangle_loop_skip test
hkernbach May 10, 2021
310e321
change log ids, adjust later (added todo), in order to perform jenkin…
hkernbach May 11, 2021
3ad7e6a
remove type from toVelocyPack and addToBuilder
hkernbach May 11, 2021
c7b6a11
rm isHybrid, modified pathvalidator templates
hkernbach May 12, 2021
88bfc65
Fixed compile issue in DFSFinderTest
mchacki May 14, 2021
f819f6a
First draft to include a generice Enumerator Interface, that can be u…
mchacki May 14, 2021
6282568
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach Jun 1, 2021
847afd3
Merge branch 'feature/hybrid-smart-graph-testsuite' of github.com:ara…
hkernbach Jun 1, 2021
94f0ab4
Moved to a Configuration based Enumerator Template. This way it is mu…
mchacki May 14, 2021
73b0038
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach Jun 1, 2021
9fa2e7d
Prepared PathValidatorOpitons to contain Prune condition
mchacki Jun 2, 2021
e44fcbe
Added ValidatorOptions and Provider information to Validator. This is…
mchacki Jun 2, 2021
ecf685f
Implemented evaluateEdgeCondition, however no one sets an edgeConditi…
mchacki Jun 2, 2021
afdc047
Make Temporary builder reusable.
mchacki Jun 2, 2021
55ec101
Moved from Edge Condition to VertexCondition. The EdgeCondition canno…
mchacki Jun 7, 2021
1b49c0e
preperation for evaluateExpression, not done yet
hkernbach Jun 7, 2021
d0ff849
prep for include of expression in indexaccessor
hkernbach Jun 8, 2021
6c13a95
return false in callback
hkernbach Jun 8, 2021
2c2557f
broken trx state
hkernbach Jun 8, 2021
7960fa1
Switched std::optional with std::unique_ptr. Somehow std::optional of…
mchacki Jun 8, 2021
9c62834
Very first draft of a PathValidatorTest based on Vertex conditions. T…
mchacki Jun 8, 2021
b4ea993
Fixed nullptr access
mchacki Jun 8, 2021
3f7ded0
still broken, transactionState cookies acceess, wip, pointer instead …
hkernbach Jun 8, 2021
097d246
Merge branch 'feature/hybrid-smart-graph-testsuite' of github.com:ara…
hkernbach Jun 8, 2021
05d17df
tmp commit - needs to be reverted before merge!
hkernbach Jun 9, 2021
e3dc6b7
Make BaseStep copy and movable
mchacki Jun 9, 2021
129da07
MockGraphProvidder now uses default step destructor
mchacki Jun 9, 2021
2b693d2
Started rewireing PathValidatorTest to use GraphMockProvider. Most te…
mchacki Jun 9, 2021
7874264
Rewritten and activated more tests for validator
mchacki Jun 9, 2021
ddaf7b0
All basic vertex tests are back online
mchacki Jun 9, 2021
751586c
Implemented a reset method in PathValidator, and used in in test.
mchacki Jun 9, 2021
a99554e
Fixed potentially out of scope for String
mchacki Jun 9, 2021
830d9b4
Implemented a very rough draft for SingleServerProvider Test
mchacki Jun 9, 2021
2f7bad6
Merge remote-tracking branch 'origin/devel' into feature/hybrid-smart…
mchacki Jun 10, 2021
3f5b04f
Fixed invalid memory access after parent move
mchacki Jun 10, 2021
c7eca19
Removed temporary debug output
mchacki Jun 10, 2021
a640b41
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach Jun 10, 2021
053e96c
Removed twice lookup of Document
mchacki Jun 10, 2021
f9b4747
pass-through all index information (depth and global)
hkernbach Jun 10, 2021
42c5e7a
remove log
hkernbach Jun 10, 2021
fc022b3
Register TransactionManager Feature in MockServers
mchacki Jun 11, 2021
0a6c535
Include nextExtra implementation in MockEdgeIndex. This is what will …
mchacki Jun 11, 2021
1404011
Moved Mock Test classes into MockFolder and include it in all tests f…
mchacki Jun 11, 2021
f8dacd9
Fixed EdgeIndexMock, it was only able to return exactly on time the l…
mchacki Jun 11, 2021
9ef5bc8
Actually count read edges
mchacki Jun 11, 2021
039fbdd
enabled depth based expressions
hkernbach Jun 11, 2021
523da6a
Merge branch 'feature/hybrid-smart-graph-testsuite' of github.com:ara…
hkernbach Jun 11, 2021
079017a
Allow to set or overwrite a variable in a FixedVarContext
mchacki Jun 11, 2021
53a65ce
Forward the FixedVarExpression Context into the Provider. This way it…
mchacki Jun 11, 2021
1e1f934
use shared expressionContext in PathValidator as well
hkernbach Jun 11, 2021
2372616
Move ValidatorOptions into the Enumerators. Also made the ValidatorOp…
mchacki Jun 14, 2021
26f7f91
Fixed Assertion in Cpp test
mchacki Jun 14, 2021
153b8fd
First rule of Results: Do not throw them, throw ARANGODB_EXCEPTION
mchacki Jun 14, 2021
91565e5
fixed one test - wrong scannedIndex in original test
hkernbach Jun 14, 2021
dcc2c77
Merge branch 'feature/hybrid-smart-graph-testsuite' of github.com:ara…
hkernbach Jun 14, 2021
b86b835
Poor persons workaround for loose end processing. This is not good, b…
mchacki Jun 14, 2021
ef8d7d0
modified complexFilteringSuite
hkernbach Jun 14, 2021
c51553d
modified optimizeQuantifierSuite
hkernbach Jun 14, 2021
2380ca7
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach Jun 14, 2021
b38fe3f
adjusted testModify
hkernbach Jun 15, 2021
c30989b
fixed queue type in DFS Enumerator Queue
hkernbach Jun 15, 2021
fd3fa59
added isCluster section to test
hkernbach Jun 15, 2021
72b4f93
Made Expressions use shared_ptr in path validator. We can happily reu…
mchacki Jun 15, 2021
7887420
allow to restrict collections
hkernbach Jun 15, 2021
1eaa27d
Merge branch 'feature/hybrid-smart-graph-testsuite' of github.com:ara…
hkernbach Jun 15, 2021
5ee84fc
fixed cpp test compilation
hkernbach Jun 16, 2021
d315a04
added method to shard to check wheter we're responsible
hkernbach Jun 18, 2021
83d5d91
trying to fix se search with lookupTable
hkernbach Jun 18, 2021
6559d38
added isResponsible method to mock provider step
hkernbach Jun 21, 2021
bed40c2
implemented schreier path building
hkernbach Jun 21, 2021
e957a22
Merge branch 'feature/hybrid-smart-graph' of github.com:arangodb/aran…
hkernbach Jun 21, 2021
96b58aa
Fixed looseEndReporting.
mchacki Jun 22, 2021
2c87281
adjusted print method
hkernbach Jun 22, 2021
eda7279
Merge branch 'feature/hybrid-smart-graph-testsuite' of github.com:ara…
hkernbach Jun 22, 2021 8000
4d6de4d
Let enumerator report Filtered Paths
mchacki Jun 22, 2021
c88f5de
removed obsolete comment
hkernbach Jun 22, 2021
7fc5a2d
Fixed unnecessary document lookup if the server is NOT responsible to…
mchacki Jun 23, 2021
817434e
Do not apply validators on Vertices the server is not responsible for…
mchacki Jun 23, 2021
a70c7d5
first commit - wip
hkernbach Jun 28, 2021
da0c73f
small refactoring to become more modular
hkernbach Jun 29, 2021
3d1ce2d
move shards back to private
hkernbach Jun 29, 2021
798c32d
add two variables to protected
hkernbach Jun 30, 2021
13f4c13
Added merge conflicts
hkernbach Jun 30, 2021
b77d41e
create unique id for shards in mock, add ability to store edge data i…
hkernbach Jun 30, 2021
054d5bf
added additional EdgeDef parameter to storeData helper method
hkernbach Jul 1, 2021
e7ed4f7
remove logging
hkernbach Jul 1, 2021
6ccc2b4
Update tests/Mocks/Servers.cpp
hkernbach Jul 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make collection to shard map a map of string -> vector<string>, requi…
…red for SmartGraphs
  • Loading branch information
mchacki committed May 5, 2021
commit c01bec86608867e7aa011091d39fc08b8894e52c
21 changes: 13 additions & 8 deletions arangod/Aql/GraphNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TRI_edge_direction_e parseDirection(AstNode const* node) {
return uint64ToDirection(dirNode->getIntValue());
}

}
} // namespace

GraphNode::GraphNode(ExecutionPlan* plan, ExecutionNodeId id,
TRI_vocbase_t* vocbase, AstNode const* direction,
Expand Down Expand Up @@ -357,7 +357,8 @@ GraphNode::GraphNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& bas
auto getAqlCollectionFromName = [&](std::string const& name) -> aql::Collection& {
// if the collection was already existent in the query, addCollection will
// just return it.
return *query.collections().add(name, AccessMode::Type::READ, aql::Collection::Hint::Collection);
return *query.collections().add(name, AccessMode::Type::READ,
aql::Collection::Hint::Collection);
};

auto vPackDirListIter = VPackArrayIterator(dirList);
Expand Down Expand Up @@ -397,7 +398,8 @@ GraphNode::GraphNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& bas
"graph needs a translation from collection to shard names");
}
for (auto const& item : VPackObjectIterator(collectionToShard)) {
_collectionToShard.insert({item.key.copyString(), item.value.copyString()});
_collectionToShard.insert({item.key.copyString(),
std::vector<std::string>{item.value.copyString()}});
}

// Out variables
Expand Down Expand Up @@ -510,9 +512,11 @@ std::string const& GraphNode::collectionToShardName(std::string const& collName)

auto found = _collectionToShard.find(collName);
if (found == _collectionToShard.end()) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL_AQL, "unable to find shard '" + collName + "' in query shard map");
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL_AQL,
"unable to find shard '" + collName +
"' in query shard map");
}
return found->second;
return found->second.front();
}

void GraphNode::toVelocyPackHelper(VPackBuilder& nodes, unsigned flags,
Expand Down Expand Up @@ -581,7 +585,8 @@ void GraphNode::toVelocyPackHelper(VPackBuilder& nodes, unsigned flags,
{
VPackObjectBuilder guard(&nodes);
for (auto const& item : _collectionToShard) {
nodes.add(item.first, VPackValue(item.second));
TRI_ASSERT(item.second.size() == 1);
nodes.add(item.first, VPackValue(item.second.front()));
}
}

Expand Down Expand Up @@ -714,8 +719,8 @@ void GraphNode::enhanceEngineInfo(VPackBuilder& builder) const {
}
#endif

void GraphNode::addEdgeCollection(Collections const& collections, std::string const& name,
TRI_edge_direction_e dir) {
void GraphNode::addEdgeCollection(Collections const& collections,
std::string const& name, TRI_edge_direction_e dir) {
auto aqlCollection = collections.get(name);
if (aqlCollection != nullptr) {
addEdgeCollection(*aqlCollection, dir);
Expand Down
11 changes: 6 additions & 5 deletions arangod/Aql/GraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

#pragma once

#include "Aql/types.h"
#include "Aql/Condition.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionNodeId.h"
#include "Aql/GraphNode.h"
#include "Aql/Graphs.h"
#include "Aql/types.h"
#include "Cluster/ClusterTypes.h"
#include "VocBase/LogicalCollection.h"
#include "VocBase/voc-types.h"
Expand Down Expand Up @@ -192,20 +192,21 @@ class GraphNode : public ExecutionNode {
void injectVertexCollection(aql::Collection& other);

std::vector<aql::Collection const*> collections() const;
void setCollectionToShard(std::map<std::string, std::string> const& map) {
void setCollectionToShard(std::unordered_map<std::string, std::vector<std::string>> const& map) {
_collectionToShard = map;
}
void addCollectionToShard(std::string const& coll, std::string const& shard) {
// NOTE: Do not replace this by emplace or insert.
// This is also used to overwrite the existing entry.
_collectionToShard[coll] = shard;
_collectionToShard[coll] = std::vector<std::string>{shard};
}

public:
graph::Graph const* graph() const noexcept;

private:
void addEdgeCollection(aql::Collections const& collections, std::string const& name, TRI_edge_direction_e dir);
void addEdgeCollection(aql::Collections const& collections,
std::string const& name, TRI_edge_direction_e dir);
void addEdgeCollection(aql::Collection& collection, TRI_edge_direction_e dir);
void addVertexCollection(aql::Collections const& collections, std::string const& name);
void addVertexCollection(aql::Collection& collection);
Expand Down Expand Up @@ -268,7 +269,7 @@ class GraphNode : public ExecutionNode {
std::unordered_map<ServerID, aql::EngineId> _engines;

/// @brief list of shards involved, required for one-shard-databases
std::map<std::string, std::string> _collectionToShard;
std::unordered_map<std::string, std::vector<std::string>> _collectionToShard;
};

} // namespace aql
Expand Down
3 changes: 2 additions & 1 deletion arangod/Graph/BaseOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ void BaseOptions::serializeVariables(VPackBuilder& builder) const {
_expressionCtx.serializeAllVariables(_query.vpackOptions(), builder);
}

void BaseOptions::setCollectionToShard(std::map<std::string, std::string> const& in) {
void BaseOptions::setCollectionToShard(
std::unordered_map<std::string, std::vector<std::string>> const& in) {
_collectionToShard = std::move(in);
}

Expand Down
6 changes: 3 additions & 3 deletions arangod/Graph/BaseOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct BaseOptions {

void serializeVariables(arangodb::velocypack::Builder&) const;

void setCollectionToShard(std::map<std::string, std::string> const&);
void setCollectionToShard(std::unordered_map<std::string, std::vector<std::string>> const&);

bool produceVertices() const { return _produceVertices; }

Expand Down Expand Up @@ -157,7 +157,7 @@ struct BaseOptions {
void activateCache(bool enableDocumentCache,
std::unordered_map<ServerID, aql::EngineId> const* engines);

std::map<std::string, std::string> const& collectionToShard() const {
std::unordered_map<std::string, std::vector<std::string>> const& collectionToShard() const {
return _collectionToShard;
}

Expand Down Expand Up @@ -215,7 +215,7 @@ struct BaseOptions {
std::unique_ptr<TraverserCache> _cache;

// @brief - translations for one-shard-databases
std::map<std::string, std::string> _collectionToShard;
std::unordered_map<std::string, std::vector<std::string>> _collectionToShard;

/// @brief a value of 1 (which is the default) means "no parallelism"
size_t _parallelism;
Expand Down
141 changes: 78 additions & 63 deletions arangod/Graph/Cache/RefactoredTraverserCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ using namespace arangodb::graph;

namespace {
bool isWithClauseMissing(arangodb::basics::Exception const& ex) {
if (ServerState::instance()->isDBServer() &&
ex.code() == TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND) {
if (ServerState::instance()->isDBServer() && ex.code() == TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND) {
// on a DB server, we could have got here only in the OneShard case.
// in this case turn the rather misleading "collection or view not found"
// error into a nicer "collection not known to traversal, please add WITH"
Expand All @@ -68,19 +67,20 @@ bool isWithClauseMissing(arangodb::basics::Exception const& ex) {

return false;
}
} // namespace
} // namespace

RefactoredTraverserCache::RefactoredTraverserCache(
arangodb::transaction::Methods* trx, aql::QueryContext* query,
arangodb::ResourceMonitor& resourceMonitor, arangodb::aql::TraversalStats& stats,
std::map<std::string, std::string> const& collectionToShardMap)
std::unordered_map<std::string, std::vector<std::string>> const& collectionToShardMap)
: _query(query),
_trx(trx),
_stringHeap(resourceMonitor, 4096), /* arbitrary block-size may be adjusted for performance */
_collectionToShardMap(collectionToShardMap),
_resourceMonitor(resourceMonitor),
_allowImplicitCollections(ServerState::instance()->isSingleServer() &&
!_query->vocbase().server().getFeature<QueryRegistryFeature>().requireWith()) {
_allowImplicitCollections(
ServerState::instance()->isSingleServer() &&
!_query->vocbase().server().getFeature<QueryRegistryFeature>().requireWith()) {
TRI_ASSERT(!ServerState::instance()->isCoordinator());
}

Expand All @@ -106,17 +106,20 @@ bool RefactoredTraverserCache::appendEdge(EdgeDocumentToken const& idToken,
return false;
}

auto res = col->getPhysical()->read(
_trx, idToken.localDocumentId(), [&](LocalDocumentId const&, VPackSlice edge) -> bool {
// NOTE: Do not count this as Primary Index Scan, we counted it in the
// edge Index before copying...
if constexpr (std::is_same_v<ResultType, aql::AqlValue>) {
result = aql::AqlValue(edge);
} else if constexpr (std::is_same_v<ResultType, velocypack::Builder>) {
result.add(edge);
}
return true;
}).ok();
auto res =
col->getPhysical()
->read(_trx, idToken.localDocumentId(),
[&](LocalDocumentId const&, VPackSlice edge) -> bool {
// NOTE: Do not count this as Primary Index Scan, we counted
// it in the edge Index before copying...
if constexpr (std::is_same_v<ResultType, aql::AqlValue>) {
result = aql::AqlValue(edge);
} else if constexpr (std::is_same_v<ResultType, velocypack::Builder>) {
result.add(edge);
}
return true;
})
.ok();
if (ADB_UNLIKELY(!res)) {
// We already had this token, inconsistent state. Return NULL in Production
LOG_TOPIC("daac5", ERR, arangodb::Logger::GRAPHS)
Expand All @@ -139,20 +142,7 @@ ResultT<std::pair<std::string, size_t>> RefactoredTraverserCache::extractCollect
}

std::string colName = idHashed.substr(0, pos).toString();
if (_collectionToShardMap.empty()) {
TRI_ASSERT(!ServerState::instance()->isDBServer());
return std::make_pair(colName, pos);
}
auto it = _collectionToShardMap.find(colName);
if (it == _collectionToShardMap.end()) {
// Connected to a vertex where we do not know the Shard to.
return Result{TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED,
"collection not known to traversal: '" + colName +
"'. please add 'WITH " + colName +
"' as the first line in your AQL"};
}
// We have translated to a Shard
return std::make_pair(it->second, pos);
return std::make_pair(colName, pos);
}

template <typename ResultType>
Expand All @@ -163,43 +153,68 @@ bool RefactoredTraverserCache::appendVertex(aql::TraversalStats& stats,
if (collectionNameResult.fail()) {
THROW_ARANGO_EXCEPTION(collectionNameResult.result());
}

std::string const& collectionName = collectionNameResult.get().first;

try {
transaction::AllowImplicitCollectionsSwitcher disallower(_trx->state()->options(), _allowImplicitCollections);

Result res = _trx->documentFastPathLocal(
collectionName,
id.substr(collectionNameResult.get().second + 1).stringRef(),
[&](LocalDocumentId const&, VPackSlice doc) -> bool {
stats.addScannedIndex(1);
// copying...
if constexpr (std::is_same_v<ResultType, aql::AqlValue>) {
result = aql::AqlValue(doc);
} else if constexpr (std::is_same_v<ResultType, velocypack::Builder>) {
result.add(doc);
}
return true;
});
if (res.ok()) {
return true;
auto findDocumentInShard = [&](std::string const& collectionName) -> bool {
try {
transaction::AllowImplicitCollectionsSwitcher disallower(_trx->state()->options(),
_allowImplicitCollections);

Result res = _trx->documentFastPathLocal(
collectionName, id.substr(collectionNameResult.get().second + 1).stringRef(),
[&](LocalDocumentId const&, VPackSlice doc) -> bool {
stats.addScannedIndex(1);
// copying...
if constexpr (std::is_same_v<ResultType, aql::AqlValue>) {
result = aql::AqlValue(doc);
} else if constexpr (std::is_same_v<ResultType, velocypack::Builder>) {
result.add(doc);
}
return true;
});
if (res.ok()) {
return true;
}

if (!res.is(TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND)) {
// ok we are in a rather bad state. Better throw and abort.
THROW_ARANGO_EXCEPTION(res);
}
} catch (basics::Exception const& ex) {
if (isWithClauseMissing(ex)) {
// turn 3D16 the error into a different error
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED,
"collection not known to traversal: '" + collectionName +
"'. please add 'WITH " + collectionName +
"' as the first line in your AQL");
}
// rethrow original error
throw;
}
return false;
};

if (!res.is(TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND)) {
// ok we are in a rather bad state. Better throw and abort.
THROW_ARANGO_EXCEPTION(res);
std::string const& collectionName = collectionNameResult.get().first;
if (_collectionToShardMap.empty()) {
TRI_ASSERT(!ServerState::instance()->isDBServer());
if (findDocumentInShard(collectionName)) {
return true;
}
} else {
auto it = _collectionToShardMap.find(collectionName);
if (it == _collectionToShardMap.end()) {
// Connected to a vertex where we do not know the Shard to.
throw Result{TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED,
"collection not known to traversal: '" + collectionName +
"'. please add 'WITH " + collectionNam CEB2 e +
"' as the first line in your AQL"};
}
} catch (basics::Exception const& ex) {
if (isWithClauseMissing(ex)) {
// turn the error into a different error
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_COLLECTION_LOCK_FAILED,
"collection not known to traversal: '" +
collectionName + "'. please add 'WITH " + collectionName +
"' as the first line in your AQL");
for (auto const& shard : it->second) {
if (findDocumentInShard(shard)) {
// Short circuit, as soon as one shard contains this document
// we can return it.
return true;
}
}
// rethrow original error
throw;
}

// Register a warning. It is okay though but helps the user
Expand Down
16 changes: 7 additions & 9 deletions arangod/Graph/Cache/RefactoredTraverserCache.h
C659
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ struct EdgeDocumentToken;

class RefactoredTraverserCache {
public:
explicit RefactoredTraverserCache(arangodb::transaction::Methods* trx,
aql::QueryContext* query,
arangodb::ResourceMonitor& resourceMonitor,
arangodb::aql::TraversalStats& stats,
std::map<std::string, std::string> const& collectionToShardMap);
explicit RefactoredTraverserCache(
arangodb::transaction::Methods* trx, aql::QueryContext* query,
arangodb::ResourceMonitor& resourceMonitor, arangodb::aql::TraversalStats& stats,
std::unordered_map<std::string, std::vector<std::string>> const& collectionToShardMap);
~RefactoredTraverserCache();

RefactoredTraverserCache(RefactoredTraverserCache const&) = delete;
Expand All @@ -81,8 +80,7 @@ class RefactoredTraverserCache {
/// @brief Inserts the real document stored within the token
/// into the given builder.
//////////////////////////////////////////////////////////////////////////////
void insertEdgeIntoResult(graph::EdgeDocumentToken const& etkn,
velocypack::Builder& builder);
void insertEdgeIntoResult(graph::EdgeDocumentToken const& etkn, velocypack::Builder& builder);

//////////////////////////////////////////////////////////////////////////////
/// @brief Inserts the real document identified by the _id string
Expand Down Expand Up @@ -148,9 +146,9 @@ class RefactoredTraverserCache {
std::unordered_set<arangodb::velocypack::HashedStringRef> _persistedStrings;

private:
std::map<std::string, std::string> const& _collectionToShardMap;
std::unordered_map<std::string, std::vector<std::string>> const& _collectionToShardMap;
arangodb::ResourceMonitor& _resourceMonitor;

/// @brief whether or not to allow adding of previously unknown collections
/// during the traversal
bool const _allowImplicitCollections;
Expand Down
8 changes: 7 additions & 1 deletion arangod/Graph/Enumerators/OneSidedEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ auto OneSidedEnumerator<QueueType, PathStoreType, ProviderType, PathValidator>::
auto posPrevious = _interior.append(step);

ValidationResult res = _validator.validatePath(step);
if ((step.getDepth() >= _options.getMinDepth()) && !res.isFiltered()) {

LOG_TOPIC("78156", TRACE, Logger::GRAPHS)
<< std::boolalpha << "<Traverser> Validated Vertex: " << step.getVertex().getID()
<< " filtered " << res.isFiltered() << " pruned " << res.isPruned()
<< " depth " << _options.getMinDepth() << " <= " << step.getDepth()
<< "<= " << _options.getMaxDepth();
if (step.getDepth() >= _options.getMinDepth() && !res.isFiltered()) {
// Include it in results.
_results.push_back(step);
}
Expand Down
Loading
0