[ 
https://issues.apache.org/jira/browse/FLINK-41613?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated FLINK-41613:
-----------------------------------
    Labels: pull-request-available  (was: )

> Document that KafkaSource keeps reading topics removed from the subscription 
> after restore
> ------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41613
>                 URL: https://issues.apache.org/jira/browse/FLINK-41613
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / Kafka, Documentation
>    Affects Versions: kafka-5.0.0
>            Reporter: SukHwan Cho
>            Priority: Minor
>              Labels: pull-request-available
>
> When a topic is removed from the subscription of a {{KafkaSource}} (for 
> example by changing {{setTopics(...)}}) and the job is restored from a 
> checkpoint or savepoint, the readers restore the splits of the removed topic 
> from state and keep reading it. Partition discovery only logs {{Discovered 
> removed partitions: [...]}} ({{KafkaSourceEnumerator}} still has {{// TODO: 
> Handle removed partitions.}}), and the topic integrity check added in 
> FLINK-40128 only checks the subscribed topics, so it does not detect this 
> either.
> This behaviour has been reported several times (FLINK-30490, FLINK-32266, 
> FLINK-34089). The recommended workaround is to change the source {{uid}} and 
> restart with {{--allow-non-restored-state}}, or to use the Dynamic Kafka 
> source (FLIP-246). The full fix is tracked in FLINK-31483. None of this is 
> mentioned in the Kafka connector documentation.
> We ran into this in production: a job switched from topic A to topic B, was 
> restored from a savepoint, and kept reading topic A for weeks, which produced 
> duplicate records downstream. The only signal was the periodic {{Discovered 
> removed partitions}} log line.
> Proposal: add a "Removing Topics from the Subscription" section to 
> docs/connectors/datastream/kafka.md (and the zh page) that explains the 
> behaviour and the uid + {{--allow-non-restored-state}} workaround, including 
> its effect on the offsets of the remaining topics, and that points to the 
> Dynamic Kafka connector.
> I would like to work on this.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to