zhijiangW opened a new pull request #9495: [FLINK-13798][task] Refactor the process of checking stream status while emitting watermark in source URL: https://github.com/apache/flink/pull/9495 ## What is the purpose of the change As we know, the watermark could be emitted to downstream only when the stream status is active. For the downstream task we already have the component of StatusWatermarkValve in StreamInputProcessor to handle this logic. But for the source task the current implementation of this logic seems a bit tricky. There are two scenarios for the source case: 1. In the source WatermarkContext, it would toggle the status as active while collecting/emitting and the status is checked in RecordWriterOutput. If the watermark is triggered by timer for AutomaticWatermarkContext, the timer task would check the status before emitting watermark. 2. TimestampsAndPeriodicWatermarksOperator: The watermark is triggered by timer, but it still relies on RecordWriterOutput to check the status before emitting. So the check logic in RecordWriterOutput only makes sense for the last scenario, and seems redundant for the first scenario. Even worse, this logic in RecordWriterOutput would bring cycle dependency with StreamStatusMaintainer, which is a blocker for the following work of integrating source processing on runtime side. To solve above issues, the basic idea is to refactor this check logic in upper layer instead of current low level RecordWriterOutput. The solution is migrating the check logic from RecordWriterOutput to TimestampsAndPeriodicWatermarksOperator. And we could further remove the logic of toggling active in WatermarkContext* ## Brief change log - *Introduce the `StreamStatusProvider` into `TimestampsAndPeriodicWatermarksOperator`* - *Remove the logic of checking status from `RecordWriterOutput`* - *Remove the logic of toggling active status in `WatermarkSourceContext`* ## Verifying this change This change is a trivial rework / code cleanup without any test coverage. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (yes / **no**) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**) - The serializers: (yes / **no** / don't know) - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know) - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know) - The S3 file system connector: (yes / **no** / don't know) ## Documentation - Does this pull request introduce a new feature? (yes / **no**) - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services