CrynetLogistics commented on a change in pull request #18651:
URL: https://github.com/apache/flink/pull/18651#discussion_r816067234
##########
File path:
flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriterTest.java
##########
@@ -862,6 +867,40 @@ private void
writeTwoElementsAndInterleaveTheNextTwoElements(
"Executor Service stuck at termination, not terminated after
500ms!");
}
+ @Test
+ public void
ifTheNumberOfUncompletedInFlightRequestsIsTooManyThenBlockInFlushMethod()
+ throws Exception {
+ CountDownLatch blockedWriteLatch = new CountDownLatch(1);
+ CountDownLatch delayedStartLatch = new CountDownLatch(1);
+ AsyncSinkWriterImpl sink =
+ new AsyncSinkReleaseAndBlockWriterImpl(
+ sinkInitContextAnyThreadMailbox,
+ 1,
+ blockedWriteLatch,
+ delayedStartLatch,
+ false);
+
+ Thread t =
+ new Thread(
+ () -> {
+ try {
+ sink.writeWithNonMailboxThread("1");
+ sink.writeWithNonMailboxThread("2");
+ sink.writeWithNonMailboxThread("3");
+ } catch (IOException | InterruptedException e) {
+ e.printStackTrace();
+ }
+ });
+ t.start();
+
+ delayedStartLatch.await();
Review comment:
Definitely. Let me add this.
--
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]