Pass autocommit context to connector on starting a transaction #25003
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.
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 inIcebergAbstractMetadata
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
Contributor checklist
Release Notes