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

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

> Expose partitions that KafkaSource keeps reading after they were removed from 
> the subscription
> ----------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41699
>                 URL: https://issues.apache.org/jira/browse/FLINK-41699
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / Kafka
>    Affects Versions: kafka-5.0.0, kafka-5.1.0
>            Reporter: SukHwan Cho
>            Priority: Minor
>              Labels: pull-request-available
>
> When a topic is removed from the subscription of a {{KafkaSource}} and the 
> job is restored from a checkpoint or savepoint, the readers keep reading the 
> restored splits of that topic (see FLINK-41613 for the docs). The only signal 
> is the line {{Discovered removed partitions: [...]}}, which 
> {{KafkaSourceEnumerator}} logs at INFO on every partition discovery (every 5 
> minutes by default). There is no metric to alert on.
> We ran into this in production: after a topic switch with a savepoint 
> restore, a job kept reading the old topic for several weeks. The INFO line 
> was the only evidence, and it was easy to miss: with JobManager HA it only 
> appears on the leader, and in one of our regions the JobManager logs were not 
> collected at all.
> Proposal, without changing which partitions are read:
> - Add a gauge {{KafkaSourceEnumerator.removedPartitions}} in the enumerator 
> metric group 
> ({{...coordinator.enumerator.KafkaSourceEnumerator.removedPartitions}}): the 
> number of partitions that are assigned to readers but were not returned by 
> the last partition discovery.
> - Log a WARN when the set of removed partitions changes, and DEBUG while it 
> stays the same, so a long-lasting state does not flood the log.
> The gauge is registered by {{KafkaSource#createEnumerator}} / 
> {{#restoreEnumerator}}, not by the {{KafkaSourceEnumerator}} constructor, 
> because the dynamic Kafka source creates one enumerator per cluster on the 
> same context and would register colliding metrics.
> Related: FLINK-31483 (handling removed splits), FLINK-41613 (docs).
> I would like to work on this.



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

Reply via email to