Repository navigation
test(jdbc): pin lazy-begin state after a failed BEGIN - #145
Merged
Merged
Conversation
A failed BEGIN during a statement must leave auto-commit off with no open Hrana stream, so the next statement retries BEGIN on a new stream. commit and rollback with no work stay no-ops after the failure, and the JDBC mode is unchanged. The lazy-begin state derived from #99 already satisfies this, so only the state-pin case is added. Fixes #108
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.
Fixes #108
Contract
Hrana 3 is the source of truth for transport, transaction and stream state;
java.sqlis the source of truth for the JDBC surface; xerial/sqlite-jdbc is a behavioral reference, not a copy target.What changed
setAutoCommit(false)already sends nothing under the lazy begin from #99, andbeginPendingis derived as!autoCommit && baton == null, so a failed BEGIN needs no separate state fix. This PR adds the missing state-pin case instead of production code:aFailedBeginPinsTheLazyBeginStateUntilTheRetrySucceedsfails the first BEGIN during a statement and then asserts:getAutoCommit()staysfalse,commit()androllback()with no work send nothing and succeed,Production code is untouched: the derived state does not drift.
Evidence
Red (pre-#99 commit
8c9381b, wheresetAutoCommit(false)began eagerly),/tmp/xerial-parity-i108/red-pre99.log:Green at the PR head (
4811c7d),/tmp/xerial-parity-i108/lane-3-specific.log:Lanes (all commands with bare
./mvnw, as the queue brief requires instead of the plan'smise exec --prefix):1bc66f9) and headlane-1-regression.log,red-pre99.log)lane-2-specific.log)lane-3-specific.log)-pl libsql-jdbc testlane-4-module-suite.log)-pl libsql-conformance -am verifylane-5-conformance.log)-Pxerial-control verifylane-6-control.log)spotless:checklane-7-spotless.log)./mvnw testlane-8-reactor.log)-Dtest=LibsqlConnectionTestlane-9-specific.log)-pl libsql-jdbc -am package -DskipTestslane-10-package.log)Perf probe (
perf.log), three interleaved runs of./mvnw -pl libsql-jdbc test:Head median is within the ten percent rule. The first head run is a compile/warm-up outlier after the package lane; the remaining two pairs differ by under 20 ms.
Divergences
beginPendingstate already satisfies the pinned behavior../mvnwwithout themise exec --prefix, per the queue brief (mise attempts an unrelated tool install here).