Package org.apache.flink.connector.jdbc
Class JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder
- java.lang.Object
-
- org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder
-
- Enclosing class:
- JdbcExactlyOnceOptions
@PublicEvolving public static class JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder extends Object
JDBCExactlyOnceOptionsBuilder.
-
-
Constructor Summary
Constructors Constructor Description JDBCExactlyOnceOptionsBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JdbcExactlyOnceOptionsbuild()JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilderwithAllowOutOfOrderCommits(boolean allowOutOfOrderCommits)Set whether transactions may be committed out-of-order in case of retries and this option is enabled.JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilderwithMaxCommitAttempts(int maxCommitAttempts)Set the number of attempt to commit a transaction (takes effect only if transient failure happens).JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilderwithRecoveredAndRollback(boolean recoveredAndRollback)Toggle discovery and rollback of prepared transactions upon recovery to prevent new transactions from being blocked by the older ones.JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilderwithTimeoutSec(Optional<Integer> timeoutSec)Set transaction timeout in seconds (vendor-specific).JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilderwithTransactionPerConnection(boolean transactionPerConnection)Set whether the same connection can be used for multiple XA transactions.
-
-
-
Method Detail
-
withRecoveredAndRollback
public JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder withRecoveredAndRollback(boolean recoveredAndRollback)
Toggle discovery and rollback of prepared transactions upon recovery to prevent new transactions from being blocked by the older ones. Each subtask rollbacks its own transaction. This flag must be disabled when rescaling to prevent data loss.
-
withMaxCommitAttempts
public JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder withMaxCommitAttempts(int maxCommitAttempts)
Set the number of attempt to commit a transaction (takes effect only if transient failure happens).
-
withAllowOutOfOrderCommits
public JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder withAllowOutOfOrderCommits(boolean allowOutOfOrderCommits)
Set whether transactions may be committed out-of-order in case of retries and this option is enabled.
-
withTimeoutSec
public JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder withTimeoutSec(Optional<Integer> timeoutSec)
Set transaction timeout in seconds (vendor-specific).
-
withTransactionPerConnection
public JdbcExactlyOnceOptions.JDBCExactlyOnceOptionsBuilder withTransactionPerConnection(boolean transactionPerConnection)
Set whether the same connection can be used for multiple XA transactions. A transaction is prepared each time a checkpoint is performed; it is committed once the checkpoint is confirmed. There can be multiple un-confirmed checkpoints and therefore multiple prepared transactions.Some databases support this natively (e.g. Oracle); while others only allow a single XA transaction per connection (e.g. MySQL, PostgreSQL).
If enabled, each transaction uses a separate connection from a pool. The database limit of open connections might need to be adjusted.
Disabled by default.
-
build
public JdbcExactlyOnceOptions build()
-
-