Repository navigation
Conversation
BEGIN TRANSACTION switched the connection to manual mode before the transaction manager could refuse the begin (only one write transaction at a time). The refused connection was then in manual mode without a transaction, and its next statement bound with a null transaction and segfaulted. The mode now changes only after the begin succeeds; read, write and recovery begins share that order. The header pins that MANUAL implies an active transaction. Tests cover a refused write and recovery begin, a refused prepared BEGIN, a refused BEGIN in a multi-statement query, a BEGIN on a poisoned WAL, and the connection's next statements, including ROLLBACK, after a refused BEGIN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Finding: header comment "Callers hold ClientContext's mutex" is wrong — method takes TransactionContext::mtx itself, |
Only beginManualTransaction takes the context's mutex; commit, rollback and clearTransaction take none, so the invariant rests on one thread per connection rather than on a caller-held lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks, reworded in 4d3b8ed: only |
This branch has not been deployed
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.
This work was produced with the help of language models.
Fixes #1316.
While another connection held a write transaction,
BEGIN TRANSACTIONwas refused withCannot start a new write transaction in the system. Only one write transaction at a time is allowed in the system., but the connection had already been switched to manual mode. Left in manual mode with no transaction, its next statement, evenMATCH (n:t) RETURN count(*), segfaulted the process, andROLLBACKcould not recover it.Fix. The read, write and recovery begins now share
beginManualTransaction, which switches to manual mode only after the transaction manager has started the transaction. A refusedBEGINleaves the connection in auto-commit mode, so its next statement runs normally and a write gets the usual single-writer error. The header states thatMANUALimplies an active transaction. No ABI change: one private non-virtual method.Tests.
RefusedBeginKeepsConnectionUsableinddl_serial_execution.testrunsROLLBACK, a read, a refused write and, once the writer commits, a full transaction on the refused connection; it trips aDASSERTonmain. Unit tests cover refused write, recovery and prepared begins, a refusedBEGINin a multi-statement query, and a poisoned WAL; all fail onmain. Full ctest: 3186/3186.