slfan1989 commented on code in PR #8998:
URL: https://github.com/apache/hadoop/pull/8998#discussion_r4636421531
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestComputeFairShares.java:
##########
@@ -237,6 +239,33 @@ public void testCPU() {
verifyCPUShares(20, 5, 5, 15);
}
+ /**
+ * The weight of a reservation queue can be set to 0 by the plan follower
+ * while the update thread is computing fair shares. If that happens after
+ * the fixed fair shares have been handled, no weight-to-resource ratio can
+ * fill the share, and the computation must still terminate.
+ */
+ @Test
+ public void testWeightChangedToZeroDuringComputation() {
+ scheds.add(new FakeSchedulable(0, 1.0f) {
+ private boolean weightRead = false;
+
+ @Override
+ public float getWeight() {
+ if (!weightRead) {
+ weightRead = true;
+ return super.getWeight();
+ }
+ return 0f;
+ }
+ });
+ assertTimeoutPreemptively(Duration.ofSeconds(30),
Review Comment:
Could we cap the number of `getWeight()` calls in the test double and fail
if that cap is exceeded? The old loop ignores interrupts, so
`assertTimeoutPreemptively` can fail the assertion while leaving the worker
spinning.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]