MartijnVisser opened a new pull request, #259:
URL: https://github.com/apache/flink-connector-jdbc/pull/259

   ## What is the purpose of the change
   
   The exactly-once JdbcSink committed its XA transaction in 
`JdbcWriter.snapshotState()`, so a checkpoint that failed after the sink's 
snapshot still had its records committed and the restart wrote them again. 
Without chaining, the committer committed nothing. Rolling back the 
transactions of an earlier job, or of this job at an earlier parallelism, is 
FLINK-41101.
   
   ## Brief change log
   
   This builds on #258 (FLINK-41135); only the last six commits belong here.
   
   - `SimpleXaConnectionProvider.failAndRollback()` rolls back a prepared 
transaction
   - `PoolingXaConnectionProvider` returns the connection to the pool once its 
transaction is prepared
   - `JdbcWriter` only prepares, and `JdbcCommitter` commits once the 
checkpoint completes
   - A restarted writer rolls back its own prepared transactions from the 
restored checkpoint on
   - The exactly-once committer runs in its own task, and new committables all 
go to its first subtask
   - The ArchUnit store freezes the uses of `SupportsPreCommitTopology` and 
`CommittableMessage` (sink2, `@Experimental`)
   - Docs: `xa_detach_on_prepare`, `max_prepared_transactions` and lock waits
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - `ExactlyOnceJdbcSinkTest`: the three `testRecoveryAfter*` tests, 
`testInsertWithoutChaining` and `testInsertInBatchMode` fail on main, 
`testUpdateRowOfThePreviousCheckpoint` fails with a chained committer
   - `ExactlyOnceTransactionPerConnectionJdbcSinkTest` runs the same tests with 
pooled connections
   - `JdbcSinkTopologyTest`: the writer keeps its operator id, with and without 
a uid
   - `JdbcCommitterTest`, `XaTransactionTest` and the Simple and Pooling XA 
connection provider tests (Derby and PostgreSQL)
   
   This conflicts with #254. Whichever lands second rebases.
   
   ## Does this pull request potentially affect one of the following parts:
   
   - Dependencies (does it add or upgrade a dependency): no
   - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: yes
   - The serializers: no
   - The runtime per-record code paths (performance sensitive): no
   - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes
   - The S3 file system connector: no
   
   ## Documentation
   
   - Does this pull request introduce a new feature? no
   - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to