Github user tzulitai commented on a diff in the pull request:
https://github.com/apache/flink/pull/3314#discussion_r102665687
--- Diff:
flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java
---
@@ -373,16 +370,28 @@ else if (partitionsRemoved) {
keyPayload.get(keyBytes);
}
- final T value =
deserializer.deserialize(keyBytes, valueBytes,
-
currentPartition.getTopic(), currentPartition.getPartition(), offset);
-
- if
(deserializer.isEndOfStream(value)) {
- // remove
partition from subscribed partitions.
-
partitionsIterator.remove();
- continue
partitionsLoop;
- }
-
- owner.emitRecord(value,
currentPartition, offset);
+ final Collector<T>
collector = new Collector<T>() {
--- End diff --
Moving the discussion back a bit:
I don't think this implementation works correctly with exactly-once and how
we checkpoint the consumer's partition offset state.
The problem is that, in `emitRecord`, we will be updating the offset state.
In the changes here, what this means is that we will be considering a record to
have been fully processed as soon as the collector collects something.
For example, lets say the serializer will call `collect` 3 times for
elements deserialized from record R before `deserialize` returns. R has offset
100L. As soon as the first element is collected, the state will be updated to
`finished processing offset 100L`. If now checkpointing is triggered, and we
use that checkpoint to restore, we will be skipping the remaining 2 elements
that were yet to be collected.
Once
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---