flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tzulitai <...@git.apache.org>
Subject [GitHub] flink pull request #2509: [FLINK-4280][kafka-connector] Explicit start posit...
Date Mon, 28 Nov 2016 10:39:55 GMT
Github user tzulitai commented on a diff in the pull request:

    --- Diff: flink-streaming-connectors/flink-connector-kafka-0.10/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumer010.java
    @@ -128,6 +129,7 @@ public FlinkKafkaConsumer010(List<String> topics, KeyedDeserializationSchema<T>
     	protected AbstractFetcher<T, ?> createFetcher(
     			SourceContext<T> sourceContext,
     			List<KafkaTopicPartition> thisSubtaskPartitions,
    +			HashMap<KafkaTopicPartition, Long> restoredSnapshotState,
    --- End diff --
    To make the startup mode logic cleaner, I've changed the `AbstractFetcher` life cycle
a bit.
    Now, restored state is provided when constructing the `AbstractFetcher`, instead of explicitly
calling `AbstractFetcher#restoreOffsets()` as a separate call.
    This allows the AbstractFetcher to have a final `isRestored` flag that version-specific
implementations can use.
    The startup offset configuring logic is much simpler now with this flag:
    if (isRestored) {
      // all subscribed partition states should have defined offset
      // setup the KafkaConsumer client we're using to respect these restored offsets
    } else {
      // all subscribed partition states have no defined offset
      // (1) set offsets depending on whether startup mode is EARLIEST, LATEST, or GROUP_OFFSET
      // (2) use the fetched offsets from Kafka to set the initial partition states we use
in Flink.

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

View raw message