Skip to content

feat(adbc): enable opt-in multi-statement transactions - #535

Open
aakash-saravanan-db wants to merge 1 commit into
mainfrom
aakash-saravanan_data/feat/mst-adbc-20261202
Open

aakash-saravanan-db wants to merge 1 commit into
mainfrom
aakash-saravanan_data/feat/mst-adbc-20261202

Conversation

@aakash-saravanan-db

Copy link
Copy Markdown
Collaborator

Description

Native ADBC applications currently receive NotImplemented when disabling autocommit. Add the database option adbc.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 InvalidState whenever 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

  • Kernel and ADBC formatting and Clippy checks passed, including all ADBC targets with ffi and warnings denied.
  • Kernel tests: 1,371 passed, 66 ignored. ADBC with ffi: 102 unit tests and 1 timezone test passed, 6 live tests ignored.
  • Existing C ABI smoke passed. The source-built ADBC driver-manager load smoke passed for both exported entrypoints with ADBC 1.0 and 1.1.

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-test Rust four-test transaction module and default-policy case, with zero failures or ignored cases. FFI and DBAPI journeys using installed Python adbc-driver-manager 1.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:

Journey Before median Candidate median Change
Low-level default connect/query/update/readback/close 2,253.9 ms 3,650.5 ms +61.96%
Default DBAPI connect/query/update/readback/close 2,029.8 ms 2,110.2 ms +3.96%
SQL-only commit journey 3,577.4 ms 3,580.0 ms +0.07%
SQL-only rollback journey 3,072.0 ms 3,078.1 ms +0.20%

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.

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>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 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 AUTOCOMMIT but 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)

@aakash-saravanan-db

aakash-saravanan-db commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

@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?

This branch was successfully deployed

1 active deployment
azure-prod — cb64c6c0 Deployed Dec 3, 2026 by aakash-saravanan-db via review #1746
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.

1 participant