Martijn Visser created FLINK-41101:
--------------------------------------

             Summary: discoverAndRollbackOnRecovery never rolls back a 
transaction against a real driver
                 Key: FLINK-41101
                 URL: https://issues.apache.org/jira/browse/FLINK-41101
             Project: Flink
          Issue Type: Bug
          Components: Connectors / JDBC
            Reporter: Martijn Visser
            Assignee: Martijn Visser
             Fix For: jdbc-6.0.0


XaTransaction.recoverAndRollback() filters the xids from XAResource.recover() 
with TransactionId.belongsTo(xid), which returns false unless the xid is a 
TransactionId. Drivers return their own Xid class, so with 
JdbcExactlyOnceOptions.isDiscoverAndRollbackOnRecovery() (the default) nothing 
is ever rolled back. The downscale check in belongsTo ({{numberOfSubtasks < 
tXid.subtaskId}}) also looks off by one.

When fixing it, the rollback must skip the transactions of checkpoints before 
the restored one: since FLINK-41060 the committer commits a transaction after 
the next checkpoint completed, and the CommitterOperator restores and commits 
those. Rolling them back on writer restore would lose their data. Only 
transactions with a checkpoint id at or above the restored checkpoint id belong 
to the writer.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to