8000 Feature/aql subquery execution block impl execute implementation bypass skip by mchacki · Pull Request #11203 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/aql subquery execution block impl execute implementation bypass skip #11203

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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
81b6699
Fixed range-handling for Modification Executors
mchacki Feb 29, 2020
01025a7
DataRange handling in ModificationExecutor
mchacki Feb 29, 2020
fe53317
Honor batch-size defined by UpstreamExecutor
mchacki Feb 29, 2020
4bae2e4
Fixed compile issue
mchacki Feb 29, 2020
8a6d636
More fixes in modification
mchacki Feb 29, 2020
9cc084b
Remvoed log devel
mchacki Feb 29, 2020
5c4e05e
Fixed profiler Test. for NoResults node we cahnge the behaviour
mchacki Feb 29, 2020
e25a5ca
Activated getSome failure tests in ExecuteRestHandler
mchacki Feb 29, 2020
08709e9
Fixed skipping in Index
mchacki Feb 29, 2020
e7b2b00
Let the MultiDependencySingleROwFetcher return the correct states.
mchacki Feb 29, 2020
368127b
Fixed non-maintainer compilation
mchacki Feb 29, 2020
6eaad9f
Attempt to fix windows compile issue
mchacki Feb 29, 2020
06c3099
Fixed the non-maintainer compile ina different way
mchacki Feb 29, 2020
68d6ebe
Added API in MultiAqlItemBlockInputRange to get Number of dependencies
mchacki Feb 29, 2020
abd617e
Comments
mchacki Feb 29, 2020
d149e39
Savepoint commit, does not compile, but no harm is done. Will start b…
mchacki Feb 29, 2020
52dcde5
Another savepoint commit. does not compile, yet.
mchacki Feb 29, 2020
5ae6cac
First draft of new Style SortingGather not yet implemented: Paralleli…
mchacki Feb 29, 2020
8fb35bb
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 29, 2020
d46e51c
Allow waiting within old-style subquery
mchacki Feb 29, 2020
94431f1
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Feb 29, 2020
1e5947a
Fixed invalid skipRwos in unsorted gather
mchacki Feb 29, 2020
b7aaa92
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 1, 2020
56c41b1
First draft of ParallelUnsortedGatherExecutor
mchacki Mar 1, 2020
474bf92
Removed unused local variables
mchacki Mar 1, 2020
854082d
Added some Assertions in MultiAqlItemBlockInputRange
mchacki Mar 1, 2020
692c3b7
Initialize dependdencies of MultiDependencyFetcher
mchacki Mar 1, 2020
d525917
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 1, 2020
03a03da
Fixed skipRows loop in UnsortingGatherNode
mchacki Mar 1, 2020
01bca14
Added an implementation for a SkipResult, in order to simplify exchan…
mchacki Mar 1, 2020
0a44131
Moved production API -> SkipResult
mchacki Mar 1, 2020
250fab7
Made tests compile with new SkipResult
mchacki Mar 1, 2020
bd53fa8
Added a test using skip and limit on subqueries
mchacki Mar 1, 2020
f72f45a
Prepared to use subqueries in SkipResult
mchacki Mar 1, 2020
9224b4c
Let subqueries modify the SkipResult subquery stack
mchacki Mar 2, 2020
fb6b9e1
Fixed return state of GatherNode
mchacki Mar 2, 2020
57ce96b
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 2, 2020
6be3180
Activate all spliced subquery tests \o/
mchacki Mar 2, 2020
563821c
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 2, 2020
6e8855b
Let SubqueryEnd honor the client request
mchacki Mar 2, 2020
c03498e
Added a Maintainer only test for the stack, if it is 36 compatible
mchacki Mar 2, 2020
d766db9
Added first part of side-effect executors. They now send upstream a f…
mchacki Mar 3, 2020
e6a8dcb
Add a fake FASTFORWARD call into a subquery-skipped ModificationExecu…
mchacki Mar 3, 2020
5659bc2
Added helper shadow row function for SideEffect executors
mchacki Mar 3, 2020
e28c231
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 3, 2020
b1c6af5
Let the Modification Executor also produce data, even if no FullCount…
mchacki Mar 4, 2020
ac94ae3
Revert "Let the Modification Executor also produce data, even if no F…
mchacki Mar 4, 2020
7695b10
Revert "Revert "Let the Modification Executor also produce data, even…
mchacki Mar 4, 2020
6bf1343
Implemented proper fastForwarding and skipReporting in ExecutorsWithS…
mchacki Mar 4, 2020
6c743bc
Removed unreachable code, somehow the G++ in our tests tries to comil…
mchacki Mar 4, 2020
970d17f
noexcept -> throw is nono good. Thank you compiler for helping me her…
mchacki Mar 4, 2020
3dba1bc
Implment copy on SkipResult
mchacki Mar 4, 2020
50c452f
Adapted SubqueryStartTest to allow easy testing for Skipping on outer…
mchacki Mar 5, 2020
1874871
Fixed koenig lookup of SkipResult ostream operator
mchacki Mar 5, 2020
62898ce
Removed special case of SubqueryStartExecutor and include it on the h…
mchacki Mar 5, 2020
a4d4017
Sorry needed to make the _operations vector mutual because of 3.6 com…
mchacki Mar 5, 2020
1fe6c3b
Attempt to fix windows compile issue
mchacki Mar 5, 2020
c7e25df
Fixed behvaiour of SubqueryEndExecutor
mchacki Mar 5, 2020
c5581e4
Another windows attempt
mchacki Mar 5, 2020
15a7d6e
Fixed modify test, which would actually iterate over too many documen…
mchacki Mar 5, 2020
c30ac78
Fixed tests that assert on existence of SubqueryNode, now there will …
mchacki Mar 5, 2020
fe1757b
Consider a hardLimitFastForward inside the Callstack like a needToSki…
mchacki Mar 5, 2020
3e4f6c7
Fixed all tests that are related to subqueries, which now need to ass…
mchacki Mar 6, 2020
435e841
Fixed jslint
mchacki Mar 6, 2020
f0bca7c
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 10, 2020
1622f08
Fixed the callstack that has been seperated from the clientCall. In s…
mchacki Mar 10, 2020
aef48b6
Fixed skip result forwarding in Scatter/Gather
mchacki Mar 11, 2020
666fe7d
Fixed assertion if the ConstFetcher gets a block with subquery level …
mchacki Mar 11, 2020
680bce4
Moved merging of SubquerySkips in MultiDependencies into the Fetcher
mchacki Mar 11, 2020
3be7aac
Removed dead code and fixed overproduction of Rows in Subquery Executor
mchacki Mar 11, 2020
7b94bb7
Fixed bypassing of skip in SideEffect executors if they trigger waiti…
mchacki Mar 11, 2020
5165f55
Refactored old SubqueryExecutor, there has been some issue with WAITI…
mchacki Mar 11, 2020
9db1c38
Removed debug logging in test
mchacki Mar 12, 2020
4ff1dd8
Fixed empty subquery executor
mchacki Mar 12, 2020
7c79a70
Added an assertion in the AqlResult that no invalid block tries to be…
mchacki Mar 12, 2020
ae61cee
Added clientId into profile tracing. Fixed return of invalid blocks i…
mchacki Mar 12, 2020
ca243b2
Removed invalid AqlExecuteResult from Test
mchacki Mar 12, 2020
48eec3e
Update tests/Aql/SubqueryStartExecutorTest.cpp
mchacki Mar 12, 2020
fe82b4b
Fixed comment, thanks to reviewer
mchacki Mar 12, 2020
54db163
Merge branch 'feature/AqlSubqueryExecutionBlockImplExecuteImplementat…
mchacki Mar 12, 2020
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
Another savepoint commit. does not compile, yet.
  • Loading branch information
mchacki committed Feb 29, 2020
commit 52dcde5ef8feaeb8cc7d2da6d8d47b4b27b7a303
5 changes: 5 additions & 0 deletions arangod/Aql/MultiAqlItemBlockInputRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ auto MultiAqlItemBlockInputRange::peekDataRow(size_t const dependency) const
return _inputs.at(dependency).peekDataRow();
}

auto MultiAqlItemBlockInputRange::skipAll(size_t const dependency) noexcept -> std::size_t {
TRI_ASSERT(dependency < _inputs.size());
return _inputs.at(dependency).skipAll()
}

auto MultiAqlItemBlockInputRange::nextDataRow(size_t const dependency)
-> std::pair<ExecutorState, arangodb::aql::InputAqlItemRow> {
TRI_ASSERT(dependency < _inputs.size());
Expand Down
1 change: 1 addition & 0 deletions arangod/Aql/MultiAqlItemBlockInputRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class MultiAqlItemBlockInputRange {

std::pair<ExecutorState, arangodb::aql::InputAqlItemRow> peekDataRow(size_t const dependency) const;
std::pair<ExecutorState, arangodb::aql::InputAqlItemRow> nextDataRow(size_t const dependency);
auto skipAll(size_t const dependency) noexcept -> std::size_t;

bool hasShadowRow() const noexcept;

Expand Down
101 changes: 85 additions & 16 deletions arangod/Aql/SortingGatherExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ class MinElementSorting final : public SortingGatherExecutor::SortingStrategy,
SortingGatherExecutor::ValueType::ValueType(size_t index)
: dependencyIndex{index}, row{CreateInvalidInputRowHint()}, state{ExecutionState::HASMORE} {}

SortingGatherExecutor::ValueType::ValueType(size_t index, InputAqlItemRow prow,
ExecutionState pstate)
: dependencyIndex{index}, row{prow}, state{pstate} {}

SortingGatherExecutorInfos::SortingGatherExecutorInfos(
std::shared_ptr<std::unordered_set<RegisterId>> inputRegisters,
std::shared_ptr<std::unordered_set<RegisterId>> outputRegisters, RegisterId nrInputRegisters,
Expand Down Expand Up @@ -249,18 +253,40 @@ std::pair<ExecutionState, NoStats> SortingGatherExecutor::produceRows(OutputAqlI
return {state, NoStats{}};
}

auto SortingGatherExecutor::initialize(typename Fetcher::DataRange const& inputRange) -> void {
auto SortingGatherExecutor::initialize(typename Fetcher::DataRange const& inputRange)
-> std::optional<std::tuple<AqlCall, size_t>> {
if (!_initialized) {
_strategy->prepare(inputRange);
// We cannot modify the number of dependencies, so we start
// with 0 dependencies, and will increase to whatever inputRange gives us.
TRI_ASSERT(_numberDependencies == 0 ||
_numberDependencies == inputRange.numberDependencies());
_numberDependencies = inputRange.numberDependencies();
auto call = requiresMoreInput(inputRange);
if (call.has_value) {
return call;
}
// If we have collected all ranges once, we can prepare the local data-structure copy
_inputRows.reserve(_numberDependencies);
for (size_t dep = 0; dep < _numberDependencies; ++dep) {
auto const [state, row] = inputRange.peekDataRow(dep);
_inputRows.emplace_back(dep, row, state);
}
_strategy->prepare(_inputRows);
_initialized = true;
_numberDependencies = inputRange.numberDependencies();
}
}

auto SortingGatherExecutor::requiresMoreInput(typename Fetcher::DataRange const& inputRange) const
auto SortingGatherExecutor::requiresMoreInput(typename Fetcher::DataRange const& inputRange)
-> std::optional<std::tuple<AqlCall, size_t>> {
for (size_t dep = 0; dep < _numberDependencies; ++dep) {
auto const& [state, input] = inputRange.peekDataRow(dep);
// Update the local copy, just to be sure it is up to date
// We might do too many copies here, but most likely this
// will not be a performance bottleneck.
ValueType& localDep = _inputRows[dep];
localDep.row = input;
localDep.state = state;
if (!input && state != ExecutorState::DONE) {
// This dependency requires input
// TODO: This call requires limits
Expand Down Expand Up @@ -293,15 +319,26 @@ auto SortingGatherExecutor::nextRow(MultiAqlItemBlockInputRange& input) -> Input
TRI_ASSERT(oneWithContent);
#endif
auto nextVal = _strategy->nextValue();
// TODO we might do some short-cuts here to maintain a list of requests
// to send in order to improve requires input
_rowsReturned++;
{
// Consume the row, and set it to next input
std::ignore = input.nextDataRow(nextVal.dependencyIndex);
auto const& [state, row] = input.peekDataRow(nextVal.dependencyIndex);
_inputRows[nextVal.dependencyIndex].state = state;
_inputRows[nextVal.dependencyIndex].row = row;

// TODO we might do some short-cuts here to maintain a list of requests
// to send in order to improve requires input
}

return nextVal.row;
}

auto SortingGatherExecutor::produceRows(typename Fetcher::DataRange& input,
OutputAqlItemRow& output)
-> std::tuple<ExecutorState, Stats, AqlCall, size_t> {
while (!isDone(input) && !output.isFull()) {
TRI_ASSERT(!maySkip());
auto maybeCall = requiresMoreInput(input);
if (maybeCall.has_value()) {
auto const& [request, dep] = maybeCall.value();
Expand All @@ -315,33 +352,65 @@ auto SortingGatherExecutor::produceRows(typename Fetcher::DataRange& input,
}
}

// Call and dependency unused
// Call and dependency unused, so we return a too large dependency
// in order to trigger asserts if it is used.
if (isDone(input)) {
return {ExecutorState::DONE, NoStats{}, AqlCall{}, 0};
return {ExecutorState::DONE, NoStats{}, AqlCall{}, _numberDependencies + 1};
}
return {ExecutorState::HASMORE, NoStats{}, AqlCall{}, 0};
return {ExecutorState::HASMORE, NoStats{}, AqlCall{}, _numberDependencies + 1};
}

auto SortingGatherExecutor::skipRowsRange(typename Fetcher::DataRange& input, AqlCall& call)
-> std::tuple<ExecutorState, Stats, size_t, AqlCall, size_t> {
while (!isDone(input) && !call.needSkipMore()) {
while (!isDone(input) && call.needSkipMore()) {
auto maybeCall = requiresMoreInput(input);
if (maybeCall.has_value()) {
auto const& [request, dep] = maybeCall.value();
return {ExecutorState::HASMORE, NoStats{}, call.getSkipCount(), request, dep};
}
auto row = nextRow(input);
TRI_ASSERT(row.isInitialized() || isDone(input));
if (row) {
call.didSkip(1);
if (call.getOffset() > 0) {
TRI_ASSERT(!maySkip());
// We need to sort still
// And account the row in the limit
auto row = nextRow(input);
TRI_ASSERT(row.isInitialized() || isDone(input));
if (row) {
call.didSkip(1);
}
} else {
// We are only called with fullcount.
// sorting does not matter.
// Start simply skip all from upstream.
for (size_t dep = 0; dep < input.numberDependencies(); ++dep) {
ExecutorState state = ExecutorState::HASMORE;
InputAqlItemRow row{CreateInvalidInputRowHint{}};
while (state == ExecutorState::HASMORE) {
std::tie(state, row) = input.nextDataRow(dep);
if (row) {
call.didSkip(1);
} else {
// We have consumed all overfetched rows.
// We may still have a skip counter within the range.
call.didSkip(input.skipAll(dep));
if (state == ExecutorState::HASMORE) {
// We need to fetch more data, but can fullCount now
AqlCall request{0, true, 0, AqlCall::LimitType::HARD};
return {ExecutorState::HASMORE, NoStats{}, call.getSkipCount(), request, dep};
}
}
}
}
}
}

// Call and dependency unused
// Call and dependency unused, so we return a too large dependency
// in order to trigger asserts if it is used.
if (isDone(input)) {
return {ExecutorState::DONE, NoStats{}, call.getSkipCount(), AqlCall{}, 0};
return {ExecutorState::DONE, NoStats{}, call.getSkipCount(), AqlCall{},
_numberDependencies + 1};
}
return {ExecutorState::HASMORE, NoStats{}, call.getSkipCount(), AqlCall{}, 0};
return {ExecutorState::HASMORE, NoStats{}, call.getSkipCount(), AqlCall{},
_numberDependencies + 1};
}

std::pair<ExecutionState, InputAqlItemRow> SortingGatherExecutor::produceNextRow(size_t const atMost) {
Expand Down
3 changes: 2 additions & 1 deletion arangod/Aql/SortingGatherExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ class SortingGatherExecutor {
struct ValueType {
size_t dependencyIndex;
InputAqlItemRow row;
ExecutionState state;
ExecutorState state;

explicit ValueType(size_t index);
ValueType(size_t, InputAqlItemRow, ExecutorState);
};

////////////////////////////////////////////////////////////////////////////////
Expand Down
0