[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_r1160621805 ## 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: Thanks for the update! LGTM now. -- 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-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[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_r1160398514 ## 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: You are right, and I suppose `globalCombinedWatermark.getTimestamp() > 0 && Long.MAX_VALUE - globalCombinedWatermark.getTimestamp() < watermarkAlignmentParams.getMaxAllowedWatermarkDrift()` would be fine? I think it better to be clear why and how it is checked. So in fact I would prefer simply adding comments in the try-catch to the bit operation if the simple expression is not enough. -- 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-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[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-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org