je-ik commented on code in PR #30141:
URL: https://github.com/apache/beam/pull/30141#discussion_r1477778043
##########
runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/io/source/unbounded/FlinkUnboundedSourceReader.java:
##########
@@ -103,22 +104,30 @@ public void start() {
createPendingBytesGauge(context);
Long watermarkInterval =
pipelineOptions.as(FlinkPipelineOptions.class).getAutoWatermarkInterval();
- if (watermarkInterval != null) {
- scheduleTaskAtFixedRate(
- () -> {
- // Set the watermark emission flag first.
- shouldEmitWatermark = true;
- // Wake up the main thread if necessary.
- CompletableFuture<Void> f = dataAvailableFutureRef.get();
- if (f != DUMMY_FUTURE) {
- f.complete(null);
- }
- },
- watermarkInterval,
- watermarkInterval);
- } else {
- LOG.warn("AutoWatermarkInterval is not set, watermarks won't be
emitted.");
+ if (watermarkInterval == null) {
+ watermarkInterval =
+
(pipelineOptions.as(FlinkPipelineOptions.class).getMaxBundleTimeMills()) / 5L;
+ watermarkInterval =
+ (watermarkInterval > MIN_WATERMARK_EMIT_INTERVAL_MS)
+ ? watermarkInterval
+ : MIN_WATERMARK_EMIT_INTERVAL_MS;
+ LOG.warn(
+ "AutoWatermarkInterval is not set, watermarks will be emitted at a
default interval of "
+ + watermarkInterval
+ + "ms");
Review Comment:
This should be the default way of logging using slf4j, it is generally
preferred over string concatenation. Please commit the change and squash the
commits again, then ping me back, I'll merge that. Thanks for the contribution!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]