Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-29038][runtime] Fix unstable case AsyncWaitOperatorTest#testProcessingTimeRepeatedCompleteOrderedWithRetry #20702

Closed
wants to merge 1 commit into from
Closed
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 @@ -20,6 +20,7 @@

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.common.time.Deadline;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.base.IntSerializer;
Expand Down Expand Up @@ -71,6 +72,7 @@
import org.junit.Test;
import org.junit.rules.Timeout;

import java.time.Duration;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -1233,22 +1235,18 @@ private void testProcessingTimeWithRetry(
testHarness.processElement(new StreamRecord<>(5, initialTime + 5));
testHarness.processElement(new StreamRecord<>(6, initialTime + 6));

ScheduledFuture<?> testTimer =
testHarness
.getTimerService()
.registerTimer(
testHarness.getTimerService().getCurrentProcessingTime()
+ TIMEOUT,
ts -> {});

expectedOutput.add(new StreamRecord<>(4, initialTime + 2));
expectedOutput.add(new StreamRecord<>(8, initialTime + 4));
expectedOutput.add(new StreamRecord<>(12, initialTime + 6));

// wait until all timers have been processed
testTimer.get();
Deadline deadline = Deadline.fromNow(Duration.ofSeconds(10));
while (testHarness.getOutput().size() < expectedOutput.size()
&& deadline.hasTimeLeft()) {
testHarness.processAll();
//noinspection BusyWait
Thread.sleep(100);
}

testHarness.processAll();
if (mode == AsyncDataStream.OutputMode.ORDERED) {
TestHarnessUtil.assertOutputEquals(
"ORDERED Output was not correct.", expectedOutput, testHarness.getOutput());
Expand Down