8000 Make AQL modification operations asynchronous by goedderz · Pull Request #21068 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Make AQL modification operations asynchronous #21068

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 29 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c787f51
Try to avoid synchronous waiting in AQL, and fix transaction lifetime…
goedderz Jun 6, 2024
a610077
Make the Query's resource monitor a shared_ptr
goedderz Jun 11, 2024
e16a0b4
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 11, 2024
2bd1475
Revert "Try to avoid synchronous waiting in AQL, and fix transaction …
goedderz Jun 11, 2024
6537d4b
Merge branch 'feature/make-query-resource-monitor-shared' into featur…
goedderz Jun 11, 2024
ee1b40d
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 13, 2024
effb1b8
Included review comments
goedderz Jun 13, 2024
b3ca915
Merge branch 'feature/make-query-resource-monitor-shared' of github.c…
goedderz Jun 17, 2024
5096702
Shorten BuilderLeaser lifetimes, and copy vocbase name
goedderz Jun 17, 2024
843f341
Added a maintainer-mode assertion
goedderz Jun 17, 2024
39522be
Serialize DBServer modification operations
goedderz Jun 17, 2024
193dc63
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 17, 2024
413fabc
Fixed gtests and CE compilation
goedderz Jun 17, 2024
68556fd
Fixed gtests
goedderz Jun 17, 2024
261fba2
Clean references to SharedAqlItemBlockPtr early enough
goedderz Jun 17, 2024
807fcb6
Fixed CE compilation
goedderz Jun 17, 2024
b821948
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 17, 2024
5543ebc
Merge branch 'feature/make-query-resource-monitor-shared' of github.c…
goedderz Jun 17, 2024
fb5beea
Make assertion concurrency-safe
goedderz Jun 17, 2024
afedb52
Unify handling of BuilderLeasers in processors
goedderz Jun 17, 2024
c4e42e5
Make internal gather nodes non-parallel in all cases
goedderz Jun 19, 2024
1b2d37d
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 19, 2024
ec9f11b
Update arangod/Transaction/Methods.cpp
goedderz Jun 20, 2024
d999326
Update arangod/Transaction/Methods.cpp
goedderz Jun 20, 2024
8ee9cc7
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 20, 2024
d8f6c20
Added CHANGELOG entry
goedderz Jun 20, 2024
d9bd683
Merge branch 'feature/make-aql-modifications-async' of github.com:ara…
goedderz Jun 20, 2024
d515b99
Avoid SIGSEGV when a database gets deleted mid-transaction
goedderz Jun 20, 2024
af69ed3
Merge branch 'devel' of github.com:arangodb/arangodb into feature/mak…
goedderz Jun 20, 2024
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
Revert "Try to avoid synchronous waiting in AQL, and fix transaction …
…lifetime issues"

This reverts commit c787f51.
  • Loading branch information
goedderz committed Jun 11, 2024
commit 2bd1475e2a838d4082fd3d2787cc2b47ca57d65d
7 changes: 7 additions & 0 deletions arangod/Aql/SimpleModifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ ExecutionState SimpleModifier<ModifierCompletion, Enable>::transact(

auto result = _completion.transact(trx, _accumulator.closeAndGetContents());

// we are currently waiting here for the `result` future to get
// ready before we continue. this makes the AQL modification
// operations blocking as in previous versions of ArangoDB.
// TODO: fix this and make it truly non-blocking (requires to
// fix some lifecycle issues for AQL queries first).
result.wait();

if (result.isReady()) {
_results = std::move(result.waitAndGet());
return ExecutionState::DONE;
Expand Down
16 changes: 8 additions & 8 deletions arangod/Transaction/Methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3604,13 +3604,11 @@ Future<Result> Methods::replicateOperations(
// we continue with the operation, since most likely, the follower was
// simply dropped in the meantime.
// In any case, we drop the follower here (just in case).
auto cb = [followerList, startTimeReplication, opName, collection, count,
vocbase = vocbase().getSharedPtr(), state = _state](
std::vector<futures::Try<network::Response>>&& responses)
auto cb = [=, this](std::vector<futures::Try<network::Response>>&& responses)
-> futures::Future<Result> {
auto duration = std::chrono::steady_clock::now() - startTimeReplication;
auto& replMetrics =
vocbase->server().getFeature<ReplicationMetricsFeature>();
vocbase().server().getFeature<ReplicationMetricsFeature>();
replMetrics.synchronousOpsTotal() += 1;
replMetrics.synchronousTimeTotal() +=
std::chrono::nanoseconds(duration).count();
Expand Down Expand Up @@ -3648,7 +3646,8 @@ Future<Result> Methods::replicateOperations(
// follower, but simply return the error and abort our local
// transaction.
if (r.is(TRI_ERROR_TRANSACTION_ABORTED) &&
state->hasHint(transaction::Hints::Hint::FROM_TOPLEVEL_AQL)) {
this->state()->hasHint(
transaction::Hints::Hint::FROM_TOPLEVEL_AQL)) {
return r;
}

Expand All @@ -3660,7 +3659,8 @@ Future<Result> Methods::replicateOperations(
absl::StrCat("got error from follower: ", r.errorMessage());

if (followerRefused) {
++vocbase->server()
++vocbase()
.server()
.getFeature<arangodb::ClusterFeature>()
.followersRefusedCounter();

Expand All @@ -3680,7 +3680,7 @@ Future<Result> Methods::replicateOperations(
}

if (!replicationFailureReason.empty()) {
if (!vocbase->server().isStopping()) {
if (!vocbase().server().isStopping()) {
LOG_TOPIC("12d8c", WARN, Logger::REPLICATION)
<< "synchronous replication of " << opName << " operation "
<< "(" << count << " doc(s)): "
Expand Down Expand Up @@ -3742,7 +3742,7 @@ Future<Result> Methods::replicateOperations(
return Result{TRI_ERROR_CLUSTER_SHARD_LEADER_RESIGNED};
} else {
// execute a deferred intermediate commit, if required.
return state->performIntermediateCommitIfRequired(collection->id());
return performIntermediateCommitIfRequired(collection->id());
}
};
return futures::collectAll(std::move(futures)).thenValue(std::move(cb));
Expand Down
4 changes: 0 additions & 4 deletions arangod/VocBase/vocbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ void TRI_vocbase_t::release() noexcept {
TRI_ASSERT(v >= 2);
}

arangodb::VocbasePtr TRI_vocbase_t::getSharedPtr() noexcept {
return VocbasePtr{use() ? this : nullptr};
}

bool TRI_vocbase_t::isDangling() const noexcept {
auto const v = _refCount.load(std::memory_order_acquire);
TRI_ASSERT((v & 1) == 0 || !isSystem());
Expand Down
3 changes: 0 additions & 3 deletions arangod/VocBase/vocbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "Containers/FlatHashMap.h"
#include "Replication2/Version.h"
#include "RestServer/arangod.h"
#include "Utils/DatabaseGuard.h"
#include "Utils/VersionTracker.h"
#include "VocBase/Identifiers/DataSourceId.h"
#include "VocBase/Identifiers/TransactionId.h"
Expand Down Expand Up @@ -294,8 +293,6 @@ struct TRI_vocbase_t {
/// @brief decrease the reference counter for a database
void release() noexcept;

arangodb::VocbasePtr getSharedPtr() noexcept;

/// @brief returns whether the database is dangling
bool isDangling() const noexcept;

Expand Down
0