curcur commented on a change in pull request #15636:
URL: https://github.com/apache/flink/pull/15636#discussion_r615969104
##########
File path:
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkFunction.java
##########
@@ -224,11 +224,11 @@ public void open(Configuration configuration) throws
Exception {
hangingXids = new
LinkedList<>(xaGroupOps.failOrRollback(hangingXids).getForRetry());
commitUpToCheckpoint(Optional.empty());
if (options.isDiscoverAndRollbackOnRecovery()) {
- // todo: consider doing recover-rollback later (e.g. after the 1st
checkpoint)
- // when we are sure that all other subtasks started and committed
any of their prepared
- // transactions
- // this would require to distinguish between this job Xids and
other Xids
- xaGroupOps.recoverAndRollback();
+ // Pending transactions which are not included into the checkpoint
might hold locks and
+ // should be rolled back. However, rolling back ALL transactions
can cause data loss. So
+ // each subtask first commits transactions from its state and then
rolls back discovered
+ // transactions if they belong to it.
+ xaGroupOps.recoverAndRollback(getRuntimeContext(), xidGenerator);
Review comment:
Do not understand this part, need to sync up off line tomorrow.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]