8000 Fix: truncate must not trigger intermediate commits in streaming trx.… · arangodb/arangodb@42ec01c · GitHub
[go: up one dir, main page]

Skip to content

Commit 42ec01c

Browse files
jsteemannmpoeter
andauthored
Fix: truncate must not trigger intermediate commits in streaming trx. (#14759)
* Fix: truncate must not trigger intermediate commits in streaming trx. * add CHANGELOG entry Co-authored-by: mpoeter <manuel@manuel-poeter.at>
1 parent 65165c4 commit 42ec01c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
devel
22
-----
33

4+
* Truncate must not trigger intermediate commits while in a streaming
5+
transaction, because that would be against the assumption that
6+
streaming transactions never do intermediate commits.
7+
48
* Added ArangoSearch condition optimization: STARTS_WITH is merged
59
with LEVENSHTEIN_MATCH if used in the same AND node and field name and prefix
610
matches.

arangod/RocksDBEngine/RocksDBCollection.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -790,12 +790,16 @@ Result RocksDBCollection::truncate(transaction::Methods& trx, OperationOptions&
790790

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

795797
// push our current transaction on the stack
796798
state->beginQuery(true);
797-
auto stateGuard = scopeGuard([state]() noexcept {
799+
auto stateGuard = scopeGuard([state, prvICC]() noexcept {
798800
state->endQuery(true);
801+
// reset to previous value after truncate is finished
802+
state->options().intermediateCommitCount = prvICC;
799803
});
800804

801805
uint64_t found = 0;
@@ -844,9 +848,6 @@ Result RocksDBCollection::truncate(transaction::Methods& trx, OperationOptions&
844848
trackWaitForSync(&trx, options);
845849
}
846850

847-
// reset to previous value after truncate is finished
848-
state->options().intermediateCommitCount = prvICC;
849-
850851
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
851852
if (state->numCommits() == 0) {
852853
// check IN TRANSACTION if documents have been deleted

0 commit comments

Comments
 (0)
0