Skip to content

fix(jdbc): drop duplicate checkClosed in prepared execute - #150

Merged
magnusp merged 1 commit into
mainfrom
fix/i81-duplicate-check
Oct 23, 2026
Merged

magnusp merged 1 commit into
mainfrom
fix/i81-duplicate-check

Conversation

@magnusp

@magnusp magnusp commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Fixes #81

Contract: Hrana 3 is the source of truth for transport, values, metadata, batching, transactions, and error reporting; java.sql is the source of truth for the JDBC surface; xerial/sqlite-jdbc is a behavioral reference and conformance foundation, never a copy target.

What changed

LibsqlPreparedStatement.executeCurrent() called checkClosed(); beginExecution(); checkClosed();. The second check runs after the state transition and before connection.executeStatement, which already checks the connection itself. Removed it, leaving the single checkClosed() before the state transition.

One file changed, one line deleted, no behavior change.

Divergence from the plan's Files block

LibsqlStatement.java is in the plan's Files block but needed no edit: its second checkClosed() was already removed in 4b30b46 (#85), which matched xerial's tolerance of execute after statement.close(). That behavior is pinned by LibsqlStatementLifecycleTest.executeAndGetConnectionStillWorkAfterClose (#148), so adding a checkClosed() to the statement execute path would be a behavior change and was not done. executeSql reads beginExecution(); with the connection check inside LibsqlConnection.executeStatement.

Evidence

Red at trunk (origin/main de31dc6): executeCurrent at lines 231-235 reads checkClosed(); beginExecution(); checkClosed();. Green at head (2621b71): one check. Log: /tmp/xerial-parity-i81/lane-3-specific.log.

Lanes at head (logs under /tmp/xerial-parity-i81/):

  1. Regression lane: not applicable. The plan's unit box says no new tests, so there is no new failing case; the diff check stands in for it (lane 3).
  2. Lifecycle and prepared suites, trunk vs head: identical, 21 LibsqlStatementLifecycleTest + 6 LibsqlPreparedStatementTest = 27/27 pass on both sides (trunk-unit.log, head-unit.log).
  3. No double check remains in either file (lane-3-specific.log).
  4. -pl libsql-jdbc test: BUILD SUCCESS, 293/293 (lane-4-module-suite.log); trunk is also 293/293 (trunk-module-suite.log).
  5. -pl libsql-conformance -am verify: BUILD SUCCESS, 123 tests, 0 failures, 1 skipped, no divergence line (lane-5-conformance.log).
  6. -Pxerial-control verify: BUILD SUCCESS, 100 tests, 0 failures, 1 skipped; differences are the pre-existing reference notes, none introduced here (lane-6-control.log).
  7. spotless:check: BUILD SUCCESS (lane-7-spotless.log).
  8. ./mvnw test: BUILD SUCCESS, 293/293 in libsql-jdbc (lane-8-reactor.log).
  9. Statement surface: BUILD SUCCESS, 30/30 (lane-9-specific.log).
  10. -pl libsql-jdbc -am package -DskipTests: BUILD SUCCESS, driver jar built (lane-10-package.log).

Perf: three interleaved ./mvnw -pl libsql-jdbc test -q runs per side, trunk first. Trunk median 2.161 s, head median 2.167 s (+0.3%, within the 10% rule). Raw values in perf-raw.txt.

Base de31dc6, head 2621b71e5c77c5a9976519942e2b8d5b2044ff29.

No merge; stopping at merge-ready.

@magnusp
magnusp merged commit ffe6f19 into main Oct 23, 2026
6 checks passed
@magnusp
magnusp deleted the fix/i81-duplicate-check branch October 23, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate checkClosed call in Statement and PreparedStatement execute

1 participant