AHeise commented on a change in pull request #18009:
URL: https://github.com/apache/flink/pull/18009#discussion_r764707200



##########
File path: 
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/FlinkKafkaInternalProducerITCase.java
##########
@@ -88,20 +92,45 @@ void testInitTransactionId() {
                     reuse.abortTransaction();
                 }
                 assertNumTransactions(i);
-                assertThat(readRecords(TEST_TOPIC).count(), equalTo(i / 2));
+                assertThat(readRecords(TEST_TOPIC).count()).isEqualTo(i / 2);
             }
         }
     }
 
+    @ParameterizedTest
+    @MethodSource("provideTransactionsFinalizer")
+    void testResetInnerTransactionIfFinalizingTransactionFailed(
+            Consumer<FlinkKafkaInternalProducer<?, ?>> transactionFinalizer) {
+        try (FlinkKafkaInternalProducer<String, String> reuse =
+                new FlinkKafkaInternalProducer<>(getProperties(), "dummy")) {
+            reuse.initTransactions();
+            reuse.beginTransaction();
+            reuse.send(new ProducerRecord<>(TEST_TOPIC, "test-value"));
+            reuse.close();

Review comment:
       I'm confused by `close` here. Afterwards, we should do anything with it 
anymore. Is that your way to ensure that the `commit` fails? How about adding a 
specific `@VisibleForTesting` method to it instead? In theory after `close` we 
should have a `checkState(!closed)` on all operations.

##########
File path: 
flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/FlinkKafkaInternalProducer.java
##########
@@ -85,16 +85,16 @@ public void beginTransaction() throws 
ProducerFencedException {
     public void abortTransaction() throws ProducerFencedException {

Review comment:
       Your commit message and PR title is wrong :)
   `FlinkKafkaInternalProducerITCase` 




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to