[ 
https://issues.apache.org/jira/browse/FLINK-7721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16183014#comment-16183014
 ] 

ASF GitHub Bot commented on FLINK-7721:
---------------------------------------

GitHub user tzulitai opened a pull request:

    https://github.com/apache/flink/pull/4738

    [FLINK-7721] [DataStream] Only emit new min watermark iff it was aggregated 
from watermark-aligned inputs

    ## What is the purpose of the change
    
    Prior to this PR, in the calculation of the new min watermark in 
`StatusWatermarkValve#findAndOutputNewMinWatermarkAcrossAlignedChannels()`, 
there is no verification that the calculated new min watermark really is 
aggregated from some aligned channel.
    
    In the corner case where all input channels are currently not aligned but 
actually some are active, we would then incorrectly determine that the final 
aggregation is `Long.MAX_VALUE` and emit that.
    
    This PR fixes this by only emitting the aggregated watermark iff it was 
really calculated from some aligned input channel (as well as the already 
existing constraint that it needs to be larger than the last emitted 
watermark). This change should also safely cover the case that a 
`Long.MAX_VALUE` was genuinely aggregated from the input channels.
    
    **This is a critical bug that should be fixed for all affecting versions: 
1.2.1, 1.3.2, 1.4.0 (master)**
    
    ## Brief change log
    
    - Fix `findAndOutputNewMinWatermarkAcrossAlignedChannels` to only output 
the new min watermark iff it was truly computed from some aligned channel.
    - Adapt `StatusWatermarkValveTest#testMultipleInputValve()` to cover the 
missing case.
    
    ## Verifying this change
    
    Verified by the modified 
`StatusWatermarkValveTest#testMultipleInputValve()`.
    Without the fix in `findAndOutputNewMinWatermarkAcrossAlignedChannels`, the 
modified test does not pass.
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): no
      - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
      - The serializers: no
      - The runtime per-record code paths (performance sensitive): **YES**
      - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? no
      - If yes, how is the feature documented? no
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tzulitai/flink FLINK-7721

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/4738.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4738
    
----
commit 29d3b74f81410ea9c2ed861c297ece8134d9b29f
Author: Tzu-Li (Gordon) Tai <[email protected]>
Date:   2017-09-27T18:05:21Z

    [FLINK-7721] [DataStream] Only emit new min watermark iff it was aggregated 
from watermark-aligned inputs
    
    Prior to this commit, In the calculation of the new min watermark in
    StatusWatermarkValve#findAndOutputNewMinWatermarkAcrossAlignedChannels(),
    there is no verification that the calculated new min watermark
    really is aggregated from some aligned channel.
    
    In the corner case where all input channels are currently not aligned
    but actually some are active, we would then incorrectly determine that
    the final aggregation is Long.MAX_VALUE and emit that.
    
    This commit fixes this by only emitting the aggregated watermark iff it was
    really calculated from some aligned input channel (as well as the
    already existing constraint that it needs to be larger than the last
    emitted watermark). This change should also safely cover the case that a
    Long.MAX_VALUE was genuinely aggregated from the input channels.

----


> StatusWatermarkValve should output a new min watermark only if it was 
> aggregated from aligned chhanels
> ------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-7721
>                 URL: https://issues.apache.org/jira/browse/FLINK-7721
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.2.1, 1.4.0, 1.3.2
>            Reporter: Tzu-Li (Gordon) Tai
>            Assignee: Tzu-Li (Gordon) Tai
>            Priority: Blocker
>             Fix For: 1.2.2, 1.4.0, 1.3.3
>
>
> Context:
> {code}
> long newMinWatermark = Long.MAX_VALUE;
> for (InputChannelStatus channelStatus : channelStatuses) {
>     if (channelStatus.isWatermarkAligned) {
>         newMinWatermark = Math.min(channelStatus.watermark, newMinWatermark);
>     }
> }
> {code}
> In the calculation of the new min watermark in 
> {{StatusWatermarkValve#findAndOutputNewMinWatermarkAcrossAlignedChannels()}}, 
> there is not verification that the calculated new min watermark 
> {{newMinWatermark}} really is aggregated from some aligned channel.
> In the corner case where all input channels are currently not aligned but 
> actually some are active, we would then incorrectly determine that the final 
> aggregation of {{newMinWatermark}} is {{Long.MAX_VALUE}} and emit that.
> The fix would simply be to only emit the aggregated watermark IFF it was 
> really calculated from some aligned input channel (as well as the already 
> existing constraint that it needs to be larger than the last emitted 
> watermark). This change should also safely cover the case that a 
> {{Long.MAX_VALUE}} was genuinely aggregated from one of the input channels.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to