shwncho commented on code in PR #354:
URL: 
https://github.com/apache/flink-connector-kafka/pull/354#discussion_r4704050700


##########
docs/content/docs/connectors/datastream/kafka.md:
##########
@@ -306,6 +306,30 @@ topics are only checked once during source startup or 
recovery.
 
 When a topic is found missing or recreated, the source fails with a 
```TopicIntegrityException```.
 
+### Removing Topics from the Subscription
+The Kafka source never revokes a split once it has been assigned to a reader. 
If you remove a topic
+from the subscription (for example by changing ```setTopics(String...)```) and 
restore the job from a
+checkpoint or savepoint, the readers restore the splits of the removed topic 
from state and keep
+reading it alongside the subscribed topics. The same applies to a topic that 
no longer matches the
+pattern of ```setTopicPattern(Pattern)``` and to partitions removed from 
```setPartitions(Set)```.
+Partition discovery detects such partitions, but only logs ```Discovered 
removed partitions: [...]```.
+The <a href="#topic-integrity-check">topic integrity check</a> does not detect 
them either, because
+it only checks the subscribed topics.
+
+To stop reading a removed topic, change the ```uid``` of the source and 
restart the job from the

Review Comment:
   Good point, thanks. Added in 8642ac2: changing the source `uid` also changes 
the generated IDs of downstream operators without a `uid`, so 
`--allowNonRestoredState` drops their state as well without an error. The docs 
ask to check that all stateful operators have a `uid` before the restart.



##########
docs/content/docs/connectors/datastream/kafka.md:
##########
@@ -306,6 +306,30 @@ topics are only checked once during source startup or 
recovery.
 
 When a topic is found missing or recreated, the source fails with a 
```TopicIntegrityException```.
 
+### Removing Topics from the Subscription
+The Kafka source never revokes a split once it has been assigned to a reader. 
If you remove a topic
+from the subscription (for example by changing ```setTopics(String...)```) and 
restore the job from a
+checkpoint or savepoint, the readers restore the splits of the removed topic 
from state and keep
+reading it alongside the subscribed topics. The same applies to a topic that 
no longer matches the
+pattern of ```setTopicPattern(Pattern)``` and to partitions removed from 
```setPartitions(Set)```.
+Partition discovery detects such partitions, but only logs ```Discovered 
removed partitions: [...]```.
+The <a href="#topic-integrity-check">topic integrity check</a> does not detect 
them either, because
+it only checks the subscribed topics.
+
+To stop reading a removed topic, change the ```uid``` of the source and 
restart the job from the
+savepoint with ```--allow-non-restored-state```. This drops the offsets of all 
splits of the source,

Review Comment:
   Thanks, you are right: the CLI only defines `-n` / 
`--allowNonRestoredState`. Fixed in 8642ac2 for this section. The same spelling 
was in the existing "Upgrading to the Latest Connector Version" section, which 
I fixed in a separate hotfix commit (bbceb75).



##########
docs/content.zh/docs/connectors/datastream/kafka.md:
##########
@@ -283,6 +283,25 @@ Source 启动或恢复时执行一次。
 
 当某个 Topic 被检测为缺失或被重建时,Source 会抛出 ```TopicIntegrityException``` 并使作业失败。
 
+<a name="removing-topics-from-the-subscription"></a>
+
+### 从订阅中移除 Topic
+Kafka Source 一旦将分片分配给某个读取器,就不会再收回该分片。如果从订阅中移除了某个 Topic(例如修改了
+```setTopics(String...)```),并从 checkpoint 或 savepoint 恢复作业,读取器会从状态中恢复被移除 Topic 
的分片,
+并在读取已订阅 Topic 的同时继续读取它。对于不再匹配 ```setTopicPattern(Pattern)``` 正则表达式的 Topic,以及从
+```setPartitions(Set)``` 中移除的分区,情况也是如此。动态分区检查能够检测到这些分区,但只会记录
+```Discovered removed partitions: [...]``` 日志。Topic 完整性检查也不会检测到它们,因为它只检查已订阅的 
Topic。
+
+要停止读取被移除的 Topic,请修改 Source 的 ```uid```,并使用 ```--allow-non-restored-state``` 
参数从 savepoint

Review Comment:
   Fixed here as well in 8642ac2 and bbceb75, and added the same downstream 
state warning.



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