MartijnVisser commented on code in PR #338:
URL: 
https://github.com/apache/flink-connector-kafka/pull/338#discussion_r4713948076


##########
flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/FlinkKafkaInternalProducerITCase.java:
##########
@@ -208,11 +208,10 @@ void testDoubleCommitAndAbort(boolean firstCommit, 
boolean secondCommit) {
                                     resumedProducer.abortTransaction();
                                 }
                             });
-            if (firstCommit == secondCommit) {
-                secondOp.doesNotThrowAnyException();
-            } else {
-                secondOp.isInstanceOf(InvalidTxnStateException.class);
-            }
+            // With Transactions V2 (KIP-890), the default since Kafka 4.0, 
ending a transaction
+            // bumps the producer epoch. A producer resumed with the epoch of 
the finished
+            // transaction is therefore fenced, whether it commits or aborts.
+            secondOp.isInstanceOf(ProducerFencedException.class);

Review Comment:
   The fencing comes from `resumeTransaction`: without `initTransactions()` the 
resumed producer sends EndTxn v4, so the coordinator applies the TV1 rules. 
With the TV2 flag set, as FLINK-40689's PR #321 does, both 4.4 brokers give the 
old outcomes again. Please keep the old assertion; until #321 lands it holds on 
a broker downgraded to TV1.



##########
flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/ExactlyOnceKafkaWriterITCase.java:
##########
@@ -208,6 +221,16 @@ private void triggerProducerException(KafkaWriter<Integer> 
writer, Properties pr
         writer.write(1, SINK_WRITER_CONTEXT);
     }
 
+    /**
+     * Waits until a record written after the first failure has failed too. 
With Transactions V2,

Review Comment:
   Nit: isn't that ordering the same under TV1? `Sender#failBatch` runs the 
callbacks before `handleFailedBatch` either way.



##########
flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/testutils/DockerImageVersions.java:
##########
@@ -24,8 +24,8 @@
  */
 public class DockerImageVersions {
 
-    public static final String CP_KAFKA = "confluentinc/cp-kafka:7.9.2";
-    public static final String APACHE_KAFKA = "apache/kafka:4.2.0";
+    public static final String CP_KAFKA = "confluentinc/cp-kafka:8.4.1";

Review Comment:
   After this no test runs against a TV1 broker. I think the sink tests need 
one; `Admin#updateFeatures` can downgrade `transaction.version` to 1.



##########
flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/KafkaTransactionLog.java:
##########
@@ -43,7 +43,10 @@
  */
 class KafkaTransactionLog {
 
-    private static final int SUPPORTED_KAFKA_SCHEMA_VERSION = 0;
+    private static final int MAX_KEY_SCHEMA_VERSION = 0;
+    // Brokers with Transactions V2 (KIP-890), the default since Kafka 4.0, 
write version 1. It

Review Comment:
   Nit: brokers write version 1 whenever `transaction.version` is 1 or higher, 
so with TV1 as well.



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