Repository navigation
A block that committed part of its work fails with PartialCommitError, not a retryable ConflictError - #508
Merged
Conversation
…twice Reproduction on the old code, before the fix: run_in_transaction refuses to replay a block that committed part of its work, but raises the conflict itself, so a program that follows the hint runs the block again. The second test runs the engine's own COMMIT RETRY refusal (engine PR 13406) and expects the same class from it.
…CommitError, not a retryable conflict run_in_transaction and with db.transaction() raise PartialCommitError (code partial_commit) for a conflict after a commit inside the block, on the last attempt too. It is not a ConflictError and the conflict is its __context__, not its __cause__, so no retry loop finds it. The engine's own TransactionException for the same refusal (engine PR 13406) gets the same class and code. A duplicated key keeps its class, as in the engine. The native build read the commit count of the thread's current context, which for a nested block is the caller's after the unwind: it refused a nested conflict that committed nothing and replayed a nested block with a commit (both seen in the CI run of the previous commit). arcadedb_n_tx ops 4 and 5 remember and read the nested block's own context. stackMark now carries the commit count too, so a with block outside a transaction costs no extra call.
This was referenced Nov 27, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #504.
When a block that had already committed part of its work (a
BATCH nboundary, orcommit()andbegin()inside it) lost a conflict, both packages raisedConflictError, whose hint says to run the transaction again. Running it again applies the committed part a second time. This PR raises a different, non-retryable error for that case.The first commit holds only tests, run on the old code. Its CI run shows the problem, and the second commit is the fix.
arcadedb-jvm, engine 26.12.1 snapshotarcadedb, engine 26.11.1ConflictErrorapplies the committed part twiceCOMMIT RETRYrefusal getspartial_commitunknown)commit()inside is not replayedThe engine pinned for dev releases (snapshot of 2026-11-06) is older than the engine change, so it raises no refusal of its own. The bindings' own refusal does not depend on the engine.
db.run_in_transaction(fn), also on the last attemptConflictError, codeconflictPartialCommitError, codepartial_commitwith db.transaction():ConflictError, codeconflictPartialCommitErrorCOMMIT RETRYblockunknownPartialCommitError, codepartial_commitConflictErrorDuplicateKeyErrorafter a commitTwo decisions:
withblock raises the same error, because its conflict carried the same hint, and the engine does the same for a block that joined a caller's transaction.__context__, not its__cause__, so neither_retry_verdictnor the native retry reply finds it, and an outerrun_in_transactiondoes not replay it.Also fixed, in the
arcadedb(native) package only: for a block that begins inside a caller's transaction, the guard compared the commit count of the caller's context instead of the block's own. The library now remembers the context of a nested block (arcadedb_n_txops 4 and 5), which costs one extra call into the library for a nested block and none otherwise.The
withblock gets its commit count from the call that already reads the transaction state beforebegin(), so a transaction outside another one costs no extra call in either package.Docs:
how-to/errors.adoc(table row and a runnable example),how-to/transactions.adoc,how-to/concurrency.adoc(the hand-written retry loop does not see a commit inside the block), and the changed behaviour section ofupgrading.adoc.