Repository navigation
feat(adbc): enable opt-in multi-statement transactions - #535
aakash-saravanan-db wants to merge 1 commit into
Conversation
Add a database transaction policy that preserves the default behavior and enables native transaction hooks when explicitly disabled. Skip repeated autocommit settings and reject commit or rollback while autocommit is enabled. Document configuration and server requirements. Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good, with one low test-coverage gap. The policy reaches the kernel correctly: the session builder treats an explicit DefaultOpts the same as leaving it unset. Autocommit short-circuits and the InvalidState guards match ADBC semantics. The unexplained +62% low-level latency regression noted in the PR description is still unresolved.
Other findings
- ⚪ Nit — The new tests mock a failed
SET AUTOCOMMITbut never a server-rejected COMMIT or ROLLBACK. Nothing checks that the error and its SQLSTATE propagate or that autocommit stays "false". Add a scoped FAILED mock for COMMIT and ROLLBACK and assert the status, sqlstate and autocommit value. (Found by Claude Opus 5.5 · confirmed by the judge)
|
@oss-reviewer-bot For the additional COMMIT/ROLLBACK mock nit in this review, the failure path is shared with existing coverage:
I’m keeping the failure assertions at those owning layers. Could you reconsider the additional per-statement mock nit with this coverage of the shared path in mind? |
Description
Native ADBC applications currently receive
NotImplementedwhen disabling autocommit. Add the database optionadbc.databricks.ignore_transactions: its default"true"preserves autocommit behavior, while"false"enables the existing native autocommit, commit and rollback hooks through the kernel. Connections initially use autocommit under either policy.Repeated autocommit settings skip SQL. Native commit and rollback now return
InvalidStatewhenever autocommit is on under either policy; they previously returned success without effect. With autocommit off, they commit or roll back and leave it off. Failed mode changes preserve the previous value and propagate the server error. The README documents configuration, prerequisites and limitations.Testing
ffiand warnings denied.ffi: 102 unit tests and 1 timezone test passed, 6 live tests ignored.The adapter tests use a mock server to verify policy plumbing, idempotence, transaction misuse and state after rejected transitions. Independent validation on Linux x86_64 and staging DBSQL passed the companion
databricks-driver-testRust four-test transaction module and default-policy case, with zero failures or ignored cases. FFI and DBAPI journeys using installed Pythonadbc-driver-manager1.13.0 on Python 3.12.11 loaded the source-built libraries and verified default and opt-in policy, real commit/rollback effects, failed transitions, reuse and pending-work close.The source-built pre-change and candidate libraries were compared on staging DBSQL. For each journey, each side had one unmeasured warmup followed by five measured runs, alternating artifact order and fully consuming results. Each journey includes connection setup through close:
The low-level default journey misses performance parity. In the two samples that set these medians, server-reported query time accounts for 1,293 ms of the 1,396.6 ms difference; the remaining 103.6 ms and a 2,040.3 ms connection step in another candidate sample are unexplained. This evidence neither identifies nor rules out a client cause; performance acceptance remains open. Native commit and rollback each passed five candidate-only timings (3,564.6 ms and 3,092.9 ms medians); there is no successful pre-change native manual-transaction baseline. These timings do not establish comparative parity.
Additional notes
Multi-statement transactions require a supporting Databricks SQL warehouse and catalog-managed tables. The ADBC isolation-level option remains unsupported. With the default policy, the DBAPI wrapper warns and stays in autocommit when its default connection setup requests autocommit off. Opting in lets that request succeed, so the wrapper starts in manual mode. Mixing SQL transaction statements with the ADBC transaction API has undefined behavior.
No new dependencies or shared-kernel changes are required. Installed native driver packages, other platforms and scheduled execution remain untested.