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


##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/ExactlyOnceKafkaWriter.java:
##########
@@ -143,28 +148,53 @@ class ExactlyOnceKafkaWriter<IN> extends KafkaWriter<IN> {
         }
 
         this.recoveredStates = checkNotNull(recoveredStates, 
"recoveredStates");
+        TaskInfo taskInfo = sinkInitContext.getTaskInfo();
+        if (recoveredStates.isEmpty()) {

Review Comment:
   As discussed offline. I do not think a task can/should do any checks if the 
state is empty.



##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/ExactlyOnceKafkaWriter.java:
##########
@@ -57,6 +58,7 @@
 
 import static org.apache.flink.util.IOUtils.closeAll;
 import static org.apache.flink.util.Preconditions.checkNotNull;
+import static org.apache.flink.util.Preconditions.checkState;
 
 /**

Review Comment:
   Can you create a high-level doc string about how the transaction mechanism 
works that future readers do not have to fully reverse engineer the code? :) 



##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/KafkaWriterStateSerializer.java:
##########
@@ -59,14 +61,20 @@ public KafkaWriterState deserialize(int version, byte[] 
serialized) throws IOExc
         try (final ByteArrayInputStream bais = new 
ByteArrayInputStream(serialized);
                 final DataInputStream in = new DataInputStream(bais)) {
             final String transactionalIdPrefix = in.readUTF();
+            int subtaskId = 0;

Review Comment:
   Is this safe to do in case of a state migration now we have multiple states 
from subtaskId 0?



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