Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pass autocommit context to connector on starting a transaction #25003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hantangwangd
Copy link
Member

@hantangwangd hantangwangd commented Apr 29, 2025

Description

Currently, we only have a connector-level method Connector.isSingleStatementWritesOnly to determine whether the entire connector supports single-statement writes exclusively, that is, whether it only permits execution within auto commit transactions.

However, some connectors have the capability not to be single-statement writes only, but certain statements (such as some non-rollbackable DDL statements) of them should not be placed in non-autocommit transactions. Therefore, the transaction's autocommit context needs to be passed to these connectors, allowing them to determine whether individual statements are permitted in non-autocommit transactions.

This PR refactors the Connector SPI to enable passing autocommit context when starting connector transactions, while maintaining backward compatibility with existing connectors. And then refactor Iceberg connector to accept and maintain autocommit context in IcebergAbstractMetadata on starting Iceberg transaction.

Motivation and Context

Allow connectors (e.g. Iceberg) to determine which statements can be executed as multi-write operations within a single non-autocommit transaction, and which must be treated as single-write only statements in autocommit transactions.

Impact

N/A

Test Plan

  • Make sure this refactoring do not affect any existing CI tests

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== NO RELEASE NOTE ==

@hantangwangd hantangwangd marked this pull request as ready for review April 29, 2025 14:36
@hantangwangd hantangwangd requested review from ZacBlanco and a team as code owners April 29, 2025 14:36
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