8000 Feature/abort traversals by hkernbach · Pull Request #21765 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/abort traversals #21765

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

Draft
wants to merge 34 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
532d00b
arangodb release 3.12.4
KVS85 Jan 23, 2025
af6afa9
first draft, added cancel of traversal in one sided enumerator, and t…
hkernbach Apr 28, 2025
4cfc171
added bidirectionalCircle as new graph in graph test suite
hkernbach May 6, 2025
db7f093
added hugeCompleteGraph
hkernbach May 6, 2025
a03dc03
added query cancel observer to twosided enumerator as well, so kpaths…
hkernbach May 13, 2025
a250d68
merge main into feature branch
hkernbach May 14, 2025
7692de9
only print debug creation info if set manually in constructor
hkernbach May 14, 2025
7ef978f
revert changelog merge issue
hkernbach May 14, 2025
67f8176
added additional check for cancelation of query in the twosidedenumer…
hkernbach May 14, 2025
8e05284
Merge remote-tracking branch 'origin/devel' into feature/abort-traver…
hkernbach May 14, 2025
2de1512
eslint
hkernbach May 14, 2025
aa29f4e
eslint
hkernbach May 16, 2025
6f21c2f
clang format
hkernbach May 16, 2025
af166b8
clang format
hkernbach May 16, 2025
f35a566
Merge remote-tracking branch 'origin/devel' into feature/abort-traver…
hkernbach May 16, 2025
e22c7c3
batchwise verted and edge insertion during fillGraph (integration tests)
hkernbach May 19, 2025
48c95dc
Merge remote-tracking branch 'origin/devel' into feature/abort-traver…
hkernbach May 19, 2025
033326a
try to help garbage collection v8
hkernbach May 19, 2025
2b79028
slightly increased timeout to 10s in clsuter, 5s in single server
hkernbach May 19, 2025
7a04512
added early exit to weighted two sided enumerator, yens still missing
hkernbach May 19, 2025
cc7991d
debug flag on
hkernbach May 19, 2025
5c4cb55
no need to call clear manually. will be called in destructor automat…
hkernbach May 20, 2025
7ff7f4f
format
hkernbach May 20, 2025
75804b8
improved wait & kill mechanism - should now be way more stable
hkernbach Jul 10, 2025
0c94492
Merge remote-tracking branch 'origin/devel' into feature/abort-traver…
hkernbach Jul 10, 2025
83aae9d
adaptive kill query
hkernbach Jul 10, 2025
e7a1026
increase debug logging. Some are optional, some are mandatory. If our…
hkernbach Jul 10, 2025
31b64e0
eslint
hkernbach Jul 10, 2025
c36118d
more test output
hkernbach Jul 11, 2025
a192771
Change test suite params
jbajic Jul 11, 2025
3ebbdee
Merge remote-tracking branch 'origin/devel' into feature/abort-traver…
hkernbach Jul 14, 2025
030d3d4
refactored generic graph tests based on Jures suggestion
hkernbach Jul 14, 2025
45d34de
incr. completegraph to consist out of 1k nodes to make computation mo…
hkernbach Jul 14, 2025
4ec116f
Merge remote-tracking branch 'origin/devel' into feature/abort-traver…
hkernbach Jul 23, 2025
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
added early exit to weighted two sided enumerator, yens still missing
  • Loading branch information
hkernbach committed May 19, 2025
commit 7a04512db0966d0a37fd77c3947b0aaa77b296cd
29 changes: 23 additions & 6 deletions arangod/Graph/Enumerators/WeightedTwoSidedEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ WeightedTwoSidedEnumerator<
PathValidator>::Ball::Ball(Direction dir, ProviderType&& provider,
GraphOptions const& options,
PathValidatorOptions validatorOptions,
arangodb::ResourceMonitor& resourceMonitor)
arangodb::ResourceMonitor& resourceMonitor,
WeightedTwoSidedEnumerator& parent)
: _resourceMonitor(resourceMonitor),
_interior(resourceMonitor),
_queue(resourceMonitor),
Expand All @@ -67,7 +68,8 @@ WeightedTwoSidedEnumerator<
_direction(dir),
_graphOptions(options),
_diameter(-std::numeric_limits<double>::infinity()),
_haveSeenOtherSide(false) {}
_haveSeenOtherSide(false),
_parent(parent) {}

template<class QueueType, class PathStoreType, class ProviderType,
class PathValidator>
Expand Down Expand Up @@ -254,6 +256,16 @@ auto WeightedTwoSidedEnumerator<QueueType, PathStoreType, ProviderType,
PathValidator>::Ball::
computeNeighbourhoodOfNextVertex(Ball& other, CandidatesStore& candidates)
-> void {
if (_graphOptions.isKilled()) {
// First clear our own instance (Ball)
clear();
// Then clear the other instance (Ball)
other.clear();
// Then clear the parent (WeightedTwoSidedEnumerator)
_parent.clear();
THROW_ARANGO_EXCEPTION(TRI_ERROR_QUERY_KILLED);
}

ensureQueueHasProcessableElement();
auto tmp = _queue.pop();

Expand Down Expand Up @@ -414,9 +426,9 @@ WeightedTwoSidedEnumerator<QueueType, PathStoreType, ProviderType,
arangodb::ResourceMonitor& resourceMonitor)
: _options(std::move(options)),
_left{Direction::FORWARD, std::move(forwardProvider), _options,
validatorOptions, resourceMonitor},
validatorOptions, resourceMonitor, *this},
_right{Direction::BACKWARD, std::move(backwardProvider), _options,
std::move(validatorOptions), resourceMonitor},
std::move(validatorOptions), resourceMonitor, *this},
_resultsCache(_left, _right),
_resultPath{_left.provider(), _right.provider()} {
// For now, we only support KShortestPaths searches, since we do not
Expand Down Expand Up @@ -466,7 +478,7 @@ void WeightedTwoSidedEnumerator<QueueType, PathStoreType, ProviderType,
template<class QueueType, class PathStoreType, class ProviderType,
class PathValidator>
bool WeightedTwoSidedEnumerator<QueueType, PathStoreType, ProviderType,
PathValidator>::isDone() const {
PathValidator>::isDone() {
if (!_candidatesStore.isEmpty()) {
return false;
}
Expand Down Expand Up @@ -861,7 +873,12 @@ WeightedTwoSidedEnumerator<QueueType, PathStoreType, ProviderType,
template<class QueueType, class PathStoreType, class ProviderType,
class PathValidator>
auto WeightedTwoSidedEnumerator<QueueType, PathStoreType, ProviderType,
PathValidator>::searchDone() const -> bool {
PathValidator>::searchDone() -> bool {
if (_options.isKilled()) {
// Here we're not inside a Ball, so we can clear via main clear method
clear();
THROW_ARANGO_EXCEPTION(TRI_ERROR_QUERY_KILLED);
}
if ((_left.noPathLeft() && _right.noPathLeft()) || isAlgorithmFinished()) {
return true;
}
Expand Down
12 changes: 9 additions & 3 deletions arangod/Graph/Enumerators/WeightedTwoSidedEnumerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class WeightedTwoSidedEnumerator {
public:
Ball(Direction dir, ProviderType&& provider, GraphOptions const& options,
PathValidatorOptions validatorOptions,
arangodb::ResourceMonitor& resourceMonitor);
arangodb::ResourceMonitor& resourceMonitor,
WeightedTwoSidedEnumerator& parent);
~Ball();
auto clear() -> void;
auto reset(VertexRef center, size_t depth = 0) -> void;
Expand Down Expand Up @@ -296,6 +297,11 @@ class WeightedTwoSidedEnumerator {
GraphOptions _graphOptions;
double _diameter = -std::numeric_limits<double>::infinity();
bool _haveSeenOtherSide;

// Reference to the parent WeightedTwoSidedEnumerator
// Intention: To be able to call clear() on the parent
// Case: When a kill signal is received
WeightedTwoSidedEnumerator& _parent;
};
enum BallSearchLocation { LEFT, RIGHT, FINISH };

Expand Down Expand Up @@ -345,7 +351,7 @@ class WeightedTwoSidedEnumerator {
* @return true There will be no further path.
* @return false There is a chance that there is more data available.
*/
[[nodiscard]] bool isDone() const;
[[nodiscard]] bool isDone();

/**
* @brief Reset to new source and target vertices.
Expand Down Expand Up @@ -410,7 +416,7 @@ class WeightedTwoSidedEnumerator {
_right.setForbiddenEdges(std::move(forbidden));
};

private : [[nodiscard]] auto searchDone() const -> bool;
private : [[nodiscard]] auto searchDone() -> bool;
// Ensure that we have fetched all vertices in the _results list. Otherwise,
// we will not be able to generate the resulting path
auto fetchResults() -> void;
Expand Down
0