You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "pltbkd (via GitHub)" <gi...@apache.org> on 2023/04/06 09:30:09 UTC

[GitHub] [flink] pltbkd commented on a diff in pull request #22291: [FLINK-31632] Fix maxAllowedWatermark arithmetic overflow when the source is idle

pltbkd commented on code in PR #22291:
URL: https://github.com/apache/flink/pull/22291#discussion_r1159523718


##########
flink-runtime/src/main/java/org/apache/flink/runtime/source/coordinator/SourceCoordinator.java:
##########
@@ -178,9 +178,16 @@ void announceCombinedWatermark() {
                                     aggregator.getAggregatedWatermark().getTimestamp());
                         });
 
-        long maxAllowedWatermark =
-                globalCombinedWatermark.getTimestamp()
-                        + watermarkAlignmentParams.getMaxAllowedWatermarkDrift();
+        long maxAllowedWatermark;
+        try {
+            maxAllowedWatermark =

Review Comment:
   nit: maybe we can check with `Long.MAX_VALUE-globalCombinedWatermark.getTimestamp() >= watermarkAlignmentParams.getMaxAllowedWatermarkDrift()`, instead of using the try-catch? 
   Or maybe it's better to add a comment explaining why an ArithmeticException can be thrown here.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org