Github user tzulitai commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2687#discussion_r105687880
  
    --- Diff: 
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java
 ---
    @@ -558,11 +629,31 @@ protected static void 
initializeSubscribedPartitionsToStartOffsets(
                        List<KafkaTopicPartition> kafkaTopicPartitions,
                        int indexOfThisSubtask,
                        int numParallelSubtasks,
    -                   StartupMode startupMode) {
    +                   StartupMode startupMode,
    +                   Map<KafkaTopicPartition, Long> specificStartupOffsets) {
     
                for (int i = 0; i < kafkaTopicPartitions.size(); i++) {
                        if (i % numParallelSubtasks == indexOfThisSubtask) {
    -                           
subscribedPartitionsToStartOffsets.put(kafkaTopicPartitions.get(i), 
startupMode.getStateSentinel());
    +                           if (startupMode != 
StartupMode.SPECIFIC_OFFSETS) {
    +                                   
subscribedPartitionsToStartOffsets.put(kafkaTopicPartitions.get(i), 
startupMode.getStateSentinel());
    +                           } else {
    +                                   if (specificStartupOffsets == null) {
    +                                           throw new 
IllegalArgumentException(
    +                                                   "Startup mode for the 
consumer set to " + StartupMode.SPECIFIC_OFFSETS +
    +                                                           ", but no 
specific offsets were specified");
    +                                   }
    +
    +                                   KafkaTopicPartition partition = 
kafkaTopicPartitions.get(i);
    +
    +                                   Long specificOffset = 
specificStartupOffsets.get(partition);
    --- End diff --
    
    Yes, that is handled according to the `auto.offset.reset` setting, 
automatically by the Kafka clients (except of 0.8, which we need to do the 
dirty work ourselves, but that logic is already implemented before).


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to