Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void snapshotState(StateSnapshotContext context) throws Exception {
public void endInput() throws Exception {
if (!isCheckpointingEnabled || isBatchMode) {
// There will be no final checkpoint, all committables should be committed here
commitAndEmitCheckpoints(lastCompletedCheckpointId + 1);
commitAndEmitCheckpoints(Long.MAX_VALUE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,33 @@ void testHandleEndInputInStreamingMode(boolean isCheckpointingEnabled) throws Ex
assertThat(testHarness.getOutput()).hasSize(2);
}

@Test
void testEmitCommittablesBatch() throws Exception {
SinkAndCounters sinkAndCounters = sinkWithoutPostCommit();
final OneInputStreamOperatorTestHarness<
CommittableMessage<String>, CommittableMessage<String>>
testHarness =
new OneInputStreamOperatorTestHarness<>(
new CommitterOperatorFactory<>(sinkAndCounters.sink, true, false));
testHarness.open();

// Test that all committables up to Long.MAX_VALUE are committed.
long checkpointId = Long.MAX_VALUE;
final CommittableSummary<String> committableSummary =
new CommittableSummary<>(1, 1, checkpointId, 1, 0, 0);
testHarness.processElement(new StreamRecord<>(committableSummary));
final CommittableWithLineage<String> committableWithLineage =
new CommittableWithLineage<>("1", checkpointId, 1);
testHarness.processElement(new StreamRecord<>(committableWithLineage));

testHarness.endInput();

assertThat(sinkAndCounters.commitCounter.getAsInt()).isEqualTo(1);
assertThat(testHarness.getOutput()).isEmpty();

testHarness.close();
}

private OneInputStreamOperatorTestHarness<
CommittableMessage<String>, CommittableMessage<String>>
createTestHarness(
Expand Down