Repository navigation
test(jdbc): pin closeOnCompletion result-set close per java.sql - #147
Merged
Merged
Conversation
Closing a result set on a statement with closeOnCompletion set closes the statement, per java.sql. The driver already did this through LibsqlResultSet; add lifecycle cases for the query, execute, and prepared paths, keep the metadata statement case from #119 in the pin, and document the rule. A probe against the pinned xerial 3.53.4.0 shows it also auto-closes (JDBC4ResultSet.close checks JDBC4Statement.closeOnCompletion, and prepared statements inherit JDBC4Statement), so no divergence exists to record.
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 #86
Contract
Hrana 3 is the source of truth for transport, values, metadata, batching, transactions, and error reporting.
java.sqlis the source of truth for the JDBC surface. xerial/sqlite-jdbc is a behavioral reference and conformance foundation, never a copy target. This change is protocol-neutral:java.sqldefines the lifecycle.What changed
Closing a result set on a statement whose
closeOnCompletionflag is set closes the statement, perjava.sql. The driver already did this inLibsqlResultSet.close(), so no production behavior changed. This PR pins the rule inLibsqlStatementLifecycleTestfor theexecuteQuery,execute+getResultSet, and prepared-statement paths, keeps the non-flag case open, and includes the #119 metadata statement case, which closes through its owncloseStatementOnCloseflag whileisCloseOnCompletion()stays false. The change toLibsqlStatement.javais the class-javadoc bullet that documents the rule.Red and green
LibsqlStatementLifecycleTest, 14/14 pass at head (fbabb79).origin/main(3adf8e3), because the behavior pre-existed. Lane 1's plan expectation of red at trunk therefore does not apply to this issue; the coverage gap, not a behavior gap, was real.LibsqlResultSet.close()in a throwaway trunk worktree fails exactly the three new close-on-completion cases (3 failures) and leaves the metadata case green. Logs:/tmp/xerial-parity-i86/lane-1-trunk.log,lane-1-head.log,lane-1-mutation.log.xerial reference note
The issue text says xerial only tracks the flag. That does not reproduce on the pinned xerial 3.53.4.0.
JDBC4ResultSet.close()closes the statement whenJDBC4Statement.closeOnCompletionis set, and prepared statements inherit that class throughCorePreparedStatement extends JDBC4Statement. A direct probe against the pinned jar shows a plain statement and a prepared statement both reportisClosed() == trueafterResultSet.close()(/tmp/xerial-parity-i86/xerial-probe.log). So this is a reference match, not a divergence: both drivers auto-close, and this PR keeps the JDBC-correct behavior with no xerial-specific exception.Evidence
Base
3adf8e3bfe05840aa3d18649e4b6036a50e35b76(origin/main), headfbabb791b6375447748ca1c501ba9d675f44c80a. Logs in/tmp/xerial-parity-i86/.-pl libsql-jdbc test -Dtest=LibsqlDatabaseMetaDataTest-pl libsql-conformance -am verify -Dit.test=MetadataLeakTest-pl libsql-jdbc test-pl libsql-conformance -am verify-pl libsql-conformance -am -Pxerial-control verifyspotless:check./mvnw testLibsqlStatementLifecycleTest-pl libsql-jdbc -am package -DskipTestsPerf:
-pl libsql-jdbc testwall clock, three interleaved runs each side. Trunk median 2.09 s, head median 2.15 s (+2.9%, within the 10% rule). No hot-path code changed.Note: the plan names
mise exec --; this environment's brief andAGENTS.mdsay to runjavaand./mvnwdirectly. Every lane above ran withoutmise.