pnowojski commented on PR #24211: URL: https://github.com/apache/flink/pull/24211#issuecomment-1960948515
> Do we know if watermarkInterval == 0 is a valid case where we are sure we need to periodically emit WatermarkStatus? My interpretation when first reading this code was that a zero value is a sentinel indicating the user isn't using watermarks. If that's the case, does the concept of "idleness" make sense anymore? Perhaps we don't emit anything for watermarkInterval == 0. Yes, that's a valid combination with idleness in at least a couple of cases: - watermark is emitted in `onEvent`, for example for every record OR if there is already some special record in the source that represents a watermark - given `Source`/`SourceReader` handles emission of watermarks on it's own, but doesn't handle idleness In both cases `watermarkInterval = 0` and `idleTimeout > 0` could be a desired configuration. > It seems like the intent was to ensure advancement under high load, rather than support the watermarkInterval == 0 case. Without this eager advancement, the code would never emit Watermark, since no timers would be scheduled & we'd never try to detect idleness. That's a good catch @dchristle! This safety net for an overloaded subtask thread I think might no longer be needed. In the past the timer thread trying to emit periodic watermark and the subtask/source thread would try to compete to acquire the same lock. AFAIK the original authors were worried about lock starvation (I'm not even sure if this was really needed, as AFAIK kernels do not guarantee fairness, but guarantee that threads won't be starved on locks acquisition). Currently the synchronisation mechanism is very different, and I would say there is no real need for this extra code path. So if it makes things simpler I would be fine removing this safety net. -- 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]
