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