You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Status

Current state: Under Discussion

Discussion thread: here (<- link to https://mail-archives.apache.org/mod_mbox/flink-dev/)

JIRA: here (<- link to https://issues.apache.org/jira/browse/FLINK-XXXX)

Released: <Flink Version>

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

StreamStatus is currently defined as follows:

A Stream Status element informs stream tasks whether or not they should continue to expect records and watermarks from the input stream that sent them. There are 2 kinds of status, namely IDLE and ACTIVE. Stream Status elements are generated at the sources, and may be propagated through the tasks of the topology. They directly infer the current status of the emitting task; a SourceStreamTask or StreamTask emits a IDLE if it will temporarily halt to emit any records or watermarks (i.e. is idle), and emits a ACTIVE once it resumes to do so (i.e. is active). 

However that definition is quite problematic. Operators with delayed responses, such as AsyncIO, windows, or time-based process functions, might output elements when they are actually IDLE. So by that definition, they would need to switch from IDLE to ACTIVE, emit an element, and go back to IDLE. It's not entirely clear when they would go back to IDLE (after each element or after some time?). Furthermore, under heavy backpressure, these additional StreamRecord s delay progress quite a bit.

At this point, it makes sense to revise the original intent of StreamStatus: being able to advance the watermark without data. Indeed, there is no reason to expand the definition towards records; we could simply limit the definition to watermarks as this is the only use case for StreamStatus in the code base currently. Moreover, that's exactly how it's implemented in Flink so far.

Idleness

Related questions is: What exactly is idleness? And how does a source instance become idle?

Idleness is a means to make progress when a source reader temporarily does not emit watermarks because it has no data. We can distinguish three cases if we just look at the source:

  1. The source uses a static assignment of splits to readers and there are more readers than sources. In this case, readers will be closed and emit MAX_WATERMARK to unblock watermark propagation indefinitely. At this point, idleness is not needed.

  2. The source uses a static assignment of splits to readers, every reader obtains at least one split, but some readers have no records in their splits temporarily (e.g. a Kafka partition became stale). In this case, a user can use WatermarkStrategy#withIdleness to let the watermark advance after a specific amount of time. However, when a partition becomes active again, there is a risk of marking records as late that wouldn't have been late without idleness.

  3. The last case is that a source uses dynamic assignment and a reader temporarily does not a have a split assigned. In this case, a reader cannot be closed and thus holds back the watermark. Unfortunately, idleness on reader level would introduce systematic errors as in the previous case but the user would have no way to avoid that.

Hence, for the 3. case, Flink needs a mechanism to sync the watermarks between source readers and source coordinator, such that no data may be potentially lost. For example, in systems that support watermarks natively, the coordinator extracts that global watermark and forwards it to the readers. Another example would be a file source that reads from time-bucketed folders where the coordinator can infer a global minimum watermark from the folder structure. This mechanism will be covered in a separate, later FLIP and is beyond the scope of this FLIP.

Nevertheless, it should be clear that we should tweak the public interfaces to make it clear that idleness should only come from a user as it's a heuristic approach. This FLIP will address the change.

Public Interfaces

Briefly list any new interfaces that will be introduced as part of this proposal or any existing interfaces that will be removed or changed. The purpose of this section is to concisely call out the public contract that will come along with this feature.

A public interface is any change to the following:

  • Binary log format

  • The network protocol and api behavior

  • Any class in the public packages under clientsConfiguration, especially client configuration

    • org/apache/kafka/common/serialization

    • org/apache/kafka/common

    • org/apache/kafka/common/errors

    • org/apache/kafka/clients/producer

    • org/apache/kafka/clients/consumer (eventually, once stable)

  • Monitoring

  • Command line tools and arguments

  • Anything else that will likely break existing users in some way when they upgrade

Proposed Changes

Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior how will we phase out the older behavior?
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Test Plan

Describe in few sentences how the FLIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?

Rejected Alternatives

If there are alternative ways of accomplishing the same thing, what were they? The purpose of this section is to motivate why the design is the way it is and not some other way.

  • No labels