AHeise commented on code in PR #154:
URL: 
https://github.com/apache/flink-connector-kafka/pull/154#discussion_r1969184961


##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/ExactlyOnceKafkaWriter.java:
##########
@@ -224,13 +243,32 @@ private void abortLingeringTransactions(
             }
         }
 
-        try (TransactionAborter transactionAborter =
-                new TransactionAborter(
-                        kafkaSinkContext.getParallelInstanceId(),
-                        kafkaSinkContext.getNumberOfParallelInstances(),
-                        id -> producerPool.getTransactionalProducer(id, 
startCheckpointId),
-                        producerPool::recycle)) {
-            transactionAborter.abortLingeringTransactions(prefixesToAbort, 
startCheckpointId);
-        }
+        LOG.info(
+                "Aborting lingering transactions with prefixes {} using {}",
+                prefixesToAbort,
+                transactionAbortStrategy);
+        TransactionAbortStrategyContextImpl context =
+                getTransactionAbortStrategyContext(startCheckpointId, 
prefixesToAbort);
+        transactionAbortStrategy.abortTransactions(context);
+    }
+
+    private TransactionAbortStrategyContextImpl 
getTransactionAbortStrategyContext(
+            long startCheckpointId, List<String> prefixesToAbort) {
+        TransactionAbortStrategyImpl.TransactionAborter aborter =
+                transactionalId -> {
+                    FlinkKafkaInternalProducer<byte[], byte[]> producer =
+                            
producerPool.getTransactionalProducer(transactionalId, 0);
+                    LOG.debug("Aborting transaction {}", transactionalId);

Review Comment:
   I'll add a comment: "getTransactionalProducer already calls 
initTransactions, which cancels the transaction".



-- 
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