8000 Fix: truncate must not trigger intermediate commits in streaming trx. by jsteemann · Pull Request #14759 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content
Dismiss alert

Fix: truncate must not trigger intermediate commits in streaming trx. #14759

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 all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
devel
-----

* Truncate must not trigger intermediate commits while in a streaming
transaction, because that would be against the assumption that
streaming transactions never do intermediate commits.

* Added ArangoSearch condition optimization: STARTS_WITH is merged
with LEVENSHTEIN_MATCH if used in the same AND node and field name and prefix
matches.
Expand Down
11 changes: 6 additions & 5 deletions arangod/RocksDBEngine/RocksDBCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,16 @@ Result RocksDBCollection::truncate(transaction::Methods& trx, OperationOptions&

// avoid OOM error for truncate by committing earlier
uint64_t const prvICC = state->options().intermediateCommitCount;
state->options().intermediateCommitCount = std::min<uint64_t>(prvICC, 10000);
if (!state->hasHint(transaction::Hints::Hint::GLOBAL_MANAGED)) {
state->options().intermediateCommitCount = std::min<uint64_t>(prvICC, 10000);
}

// push our current transaction on the stack
state->beginQuery(true);
auto stateGuard = scopeGuard([state]() noexcept {
auto stateGuard = scopeGuard([state, prvICC]() noexcept {
state->endQuery(true);
// reset to previous value after truncate is finished
state->options().intermediateCommitCount = prvICC;
});

uint64_t found = 0;
Expand Down Expand Up @@ -844,9 +848,6 @@ Result RocksDBCollection::truncate(transaction::Methods& trx, OperationOptions&
trackWaitForSync(&trx, options);
}

// reset to previous value after truncate is finished
state->options().intermediateCommitCount = prvICC;

#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
if (state->numCommits() == 0) {
// check IN TRANSACTION if documents have been deleted
Expand Down
0