MartijnVisser commented on code in PR #314:
URL:
https://github.com/apache/flink-connector-kafka/pull/314#discussion_r4770707721
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/KafkaWriterStateSerializer.java:
##########
@@ -31,11 +31,17 @@
import static org.apache.flink.connector.kafka.sink.KafkaWriterState.UNKNOWN;
-/** A serializer used to serialize {@link KafkaWriterState}. */
+/**
+ * A serializer used to serialize {@link KafkaWriterState}.
+ *
+ * <p>Version 3 adds the producer id and epoch of every precommitted
transaction, so that a recovery
+ * can tell a transaction the committer still has to commit from a later
transaction that reused the
+ * same transactional id. State written by version 2 is read with unknown
producer id and epoch.
+ */
class KafkaWriterStateSerializer implements
SimpleVersionedSerializer<KafkaWriterState> {
@Override
public int getVersion() {
- return 2;
+ return 3;
Review Comment:
Every exactly-once sink, INCREMENTING too, now writes v3, which 5.1.0 can't
read. Can the release note say so?
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/internal/TransactionAbortStrategyImpl.java:
##########
@@ -205,6 +214,22 @@ public interface Context {
*/
Set<String> getPrecommittedTransactionalIds();
+ /**
+ * Returns whether the broker reported a later, still ongoing
transaction under the given
+ * transactional id than the precommitted one, opened under a newer
producer epoch after the
+ * id was reused. The precommitted transaction is then already
committed or aborted, and the
+ * committer's commit of it will be fenced. Returns {@code false} when
the state did not
Review Comment:
With a new producer id the commit fails with INVALID_PRODUCER_ID_MAPPING,
not fenced. Main has that too, could you open a ticket for it and drop the
fencing claim here and in the warning?
--
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]