Skip to content

[flink] Emit the watermark when local merge flushes an empty buffer - #10832

Open
LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:fix/local-merge-filtered-watermark
Open

LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:fix/local-merge-filtered-watermark

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

close #10831

LocalMergeOperator holds back the watermark and emits it in flushBuffer() after the buffered rows. flushBuffer() returned early when the buffer was empty, so the watermark was not emitted. When records are filtered out before the sink while the source watermark advances, the buffer is empty at every checkpoint, and the snapshot watermark stays where it was when the last record arrived.

flushBuffer() now only skips the row output when the buffer is empty and still emits the watermark.

Tests

  • LocalMergeWatermarkITCase#testWatermarkAdvancesWhileRecordsAreFilteredOut: a streaming job writes to a primary key table with local-merge-buffer-size through a filter that only lets the first record through, while the source watermark keeps advancing. It waits for the snapshot watermark to advance past its first value. On master it stays at 0 and the test times out; without local-merge-buffer-size it passes on master too.
  • LocalMergeOperatorTest#testEmptyFlushStillEmitsWatermark: a watermark followed by prepareSnapshotPreBarrier with no records emits the watermark and no rows.

API and Format

no

Documentation

no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Local merge holds back the watermark when records are filtered out before the sink

1 participant