Repository navigation
[PECOBLR-2089] Add generic transaction control to Session + C ABI - #182
Merged
Merged
Conversation
Transaction control (autocommit / commit / rollback) belongs in the kernel, not in each driver: it is pure engine behavior expressed as session-scoped SQL, identical for every consumer. Centralizing it here means ODBC, Python, Go, and Node all get the same transaction semantics from one implementation (the same rationale as the shared kernel_metadata_* surface). Rust (`Session`): - set_autocommit(bool) / autocommit() / commit() / rollback(). The mutating calls run session-scoped SQL — `SET AUTOCOMMIT = TRUE|FALSE`, `COMMIT`, `ROLLBACK` — via the existing statement path (no result set to drain), mirroring the reference and JDBC drivers. Autocommit is client-tracked in SessionInner (cached, not round-tripped), like JDBC's DatabricksSession. - Gated by DefaultOpts::ignore_transactions (default true = mirror IgnoreTransactions=1): when set, the control methods are silent no-ops; when false, real multi-statement transactions run. Builder shortcut SessionBuilder::ignore_transactions (needed because DefaultOpts is #[non_exhaustive], so external callers can't struct-literal it). C ABI (mirrors the Rust API for all wrappers): - kernel_session_set_autocommit / _get_autocommit / _commit / _rollback. - kernel_session_config_set_ignore_transactions on the config builder. - Header declarations in databricks_kernel.h. Tests: - Unit (wiremock): with ignore_transactions=true the control methods no-op and succeed without issuing any statement (the mock exposes no statement endpoint, so a stray SQL call would fail); DefaultOpts default is true. - e2e (tests/v0_transactions_e2e.rs, #[ignore]): on a catalog-managed table, ignore_transactions=false → autocommit-off + INSERT + ROLLBACK removes the row and COMMIT persists; ignore_transactions=true → calls are no-ops and the auto-committed row survives a ROLLBACK. 703 unit tests pass; cargo fmt + clippy --all-targets clean. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
vikrantpuppala
temporarily deployed
to
azure-prod
July 21, 2026 06:33 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
July 21, 2026 06:33 — with
GitHub Actions
Inactive
Collaborator
Author
|
Confirmed: ran the So the real transaction path (ignore_transactions=false → autocommit-off + INSERT + ROLLBACK removes the row; COMMIT persists) and the no-op path (default) are both validated end-to-end through the kernel code, not just against the reference driver. |
gopalldb
approved these changes
Jul 21, 2026
sreekanth-db
approved these changes
Jul 21, 2026
This branch was previously deployed
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.
What
Adds multi-statement transaction control to the kernel
Sessionand C ABI, so all drivers on the kernel (ODBC, Python, Go, Node) get identical transaction semantics from one implementation — rather than each reimplementing the SQL and state tracking.Why here (not in the drivers)
Transaction control is pure engine behavior: session-scoped SQL (
SET AUTOCOMMIT,COMMIT,ROLLBACK), identical for every consumer. Centralizing it is the same call the kernel already made forkernel_metadata_*. Doing it per-driver would mean 4 copies of the SQL strings, the autocommit state machine, and theIgnoreTransactionsgating — guaranteed to drift.API
Rust (
Session):set_autocommit(bool)/autocommit()/commit()/rollback().SessionInner(cached, not round-tripped), mirroring the reference/JDBC drivers.DefaultOpts::ignore_transactions(defaulttrue, matching the reference/JDBCIgnoreTransactions=1): when set, the methods are silent no-ops; whenfalse, real transactions run. Builder shortcutSessionBuilder::ignore_transactions(needed becauseDefaultOptsis#[non_exhaustive]).C ABI (mirrors the Rust API):
kernel_session_set_autocommit/_get_autocommit/_commit/_rollback.kernel_session_config_set_ignore_transactionson the config builder.databricks_kernel.h.Testing
ignore_transactions = truethe control methods no-op and succeed without issuing any statement — the mock exposes no statement endpoint, so a stray SQL call would fail; their success proves the short-circuit. PlusDefaultOptsdefault istrue.tests/v0_transactions_e2e.rs,#[ignore]): on a catalog-managed Delta table,ignore_transactions = false→ autocommit-off + INSERT + ROLLBACK removes the row and COMMIT persists;ignore_transactions = true→ the calls are no-ops and the auto-committed row survives a ROLLBACK. (Verified manually against a dogfood warehouse during development.)cargo fmt+clippy --all-targetsclean.Consumers
The ODBC driver (PECOBLR-2089, Tier 3A transactions) will consume these C ABI functions directly — its
SQLEndTran/SQL_ATTR_AUTOCOMMIThandlers become thin calls into the kernel instead of driver-issued SQL. Python/Go/Node get the same for free.This pull request and its description were written by Isaac.