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


##########
docs/content/docs/connectors/datastream/kafka.md:
##########
@@ -244,6 +244,11 @@ Please note that the following keys will be set by the 
builder:
   for the starting offsets unless it is explicitly configured. The initializer 
selects the initial
   position, while an explicitly configured ```auto.offset.reset``` controls 
what happens if an
   initialized position later becomes unavailable.
+  ```OffsetsInitializer.earliest()```, ```latest()``` and 
```timestamp(long)``` use ```EARLIEST```:
+  if the source falls behind topic retention, or is restored from a checkpoint 
whose offsets were
+  already deleted, it continues from the earliest offset still in the log 
instead of skipping the

Review Comment:
   Please add the other direction: restored above the log end, after a 
truncation or a recreated topic, the source rereads everything retained.



##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/LatestOffsetsInitializer.java:
##########
@@ -40,8 +40,15 @@ public Map<TopicPartition, Long> getPartitionOffsets(
         return partitionOffsetsRetriever.endOffsets(partitions);
     }
 
+    /**
+     * The starting offsets are resolved by the enumerator and are within the 
log at that time, so
+     * this strategy only applies to a position that left the log afterwards: 
a running or restored

Review Comment:
   Also covers a restored position above the log end (recreated topic, 
truncated log). Please update `OffsetsInitializer#getAutoOffsetResetStrategy` 
too; its `@PublicEvolving` Javadoc still says initial offsets only.



##########
docs/content/docs/connectors/datastream/kafka.md:
##########
@@ -244,6 +244,11 @@ Please note that the following keys will be set by the 
builder:
   for the starting offsets unless it is explicitly configured. The initializer 
selects the initial
   position, while an explicitly configured ```auto.offset.reset``` controls 
what happens if an
   initialized position later becomes unavailable.
+  ```OffsetsInitializer.earliest()```, ```latest()``` and 
```timestamp(long)``` use ```EARLIEST```:
+  if the source falls behind topic retention, or is restored from a checkpoint 
whose offsets were
+  already deleted, it continues from the earliest offset still in the log 
instead of skipping the
+  remaining records. Set ```auto.offset.reset``` to ```latest``` to skip to 
the end of the log

Review Comment:
   Doing this now logs the `KafkaSourceBuilder` warning that `latest` differs 
from `earliest`. Might make sense to drop that warning for initializers that 
resolve concrete offsets.



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