StephanEwen commented on a change in pull request #13593:
URL: https://github.com/apache/flink/pull/13593#discussion_r503411328



##########
File path: 
flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/fetcher/SplitFetcherTest.java
##########
@@ -120,16 +120,16 @@ public void testNotifiesWhenGoingIdleConcurrent() throws 
Exception {
                final SplitFetcher<Object, TestingSourceSplit> fetcher = 
createFetcherWithSplit(
                        "test-split", queue, new 
TestingSplitReader<>(finishedSplitFetch("test-split")));
 
-               final QueueDrainerThread queueDrainer = new 
QueueDrainerThread(queue);
+               final QueueDrainerThread queueDrainer = new 
QueueDrainerThread(queue, fetcher, 1);
                queueDrainer.start();
 
-               try {
-                       fetcher.runOnce();
+               fetcher.runOnce();
 
-                       assertTrue(queue.getAvailabilityFuture().isDone());
-               } finally {
-                       queueDrainer.shutdown();
-               }
+               queueDrainer.sync();
+
+               // either we got the notification that the fetcher went idle 
after the queue was drained (thread finished)
+               // or the fetcher was already idle when the thread drained the 
queue (then we need no additional notification)
+               assertTrue(queue.getAvailabilityFuture().isDone() || 
queueDrainer.wasIdleWhenFinished());

Review comment:
       yes, exactly. And this assertion is also exactly what the 
`SourceReaderBase` assumes. Either `isIdle` was true when it finished the poll 
and it could shut down the fetcher, or the availability future was complete, 
and the reader will be polled again.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to