arunpandianp commented on code in PR #40593:
URL: https://github.com/apache/beam/pull/40593#discussion_r4296949814


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/BoundedQueueExecutor.java:
##########


Review Comment:
   done.



##########
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/util/BoundedQueueExecutorTest.java:
##########
@@ -742,25 +688,26 @@ public void 
testPollWork_purgeBacksOffWhileQueueHoldsMostlyUnstartedWork() throw
           createWorkWithCompIdAndKeyGroup("compA", keyGroup, ignored -> {}), 
10);
     }
 
-    // The first steal purges its own stale shell; the remaining steals back 
off until the queue
-    // grows by more than maximumElementsOutstanding.
-    for (int i = 0; i < numWorks; i++) {
-      assertNotNull(
-          testExecutor.pollWork("compA", keyGroup, stealHandle, 
FAILING_FAILED_WORK_HANDLER));
-    }
-    assertEquals(numWorks - 1, testExecutor.executorQueueSize());
-
-    for (int i = 0; i <= maximumElementsOutstanding; i++) {
-      testExecutor.forceExecute(
-          createWorkWithCompIdAndKeyGroup("compA", keyGroup, ignored -> {}), 
10);
+    // Each steal leaves a stale shell in the executor queue. While bundle1 is 
open, its stolen
+    // work is still counted in elementsOutstanding, so there is nothing to 
purge.
+    int numStolenByBundle1 = maximumElementsOutstanding + 2;
+    for (int i = 0; i < numStolenByBundle1; i++) {
+      assertNotNull(testExecutor.pollWork("compA", keyGroup, bundle1, 
FAILING_FAILED_WORK_HANDLER));
     }
-    assertNotNull(
-        testExecutor.pollWork("compA", keyGroup, stealHandle, 
FAILING_FAILED_WORK_HANDLER));
-    assertEquals(maximumElementsOutstanding, testExecutor.executorQueueSize());
+    assertEquals(numWorks, testExecutor.rawQueueSizeForTesting());

Review Comment:
   done.



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

Reply via email to