This is an automated email from the ASF dual-hosted git repository.

slfan1989 pushed a commit to branch branch-3.4.0
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.4.0 by this push:
     new 2b68496fad2b YARN-11639. CME and NPE in 
PriorityUtilizationQueueOrderingPolicy (#6455)
2b68496fad2b is described below

commit 2b68496fad2b9bfb2c4c11ebeecb19a62eeb49d2
Author: Ferenc Erdelyi <55103964+ferde...@users.noreply.github.com>
AuthorDate: Mon Jan 22 15:41:48 2024 +0100

    YARN-11639. CME and NPE in PriorityUtilizationQueueOrderingPolicy (#6455)
---
 .../capacity/policy/PriorityUtilizationQueueOrderingPolicy.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/policy/PriorityUtilizationQueueOrderingPolicy.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/policy/PriorityUtilizationQueueOrderingPolicy.java
index d12a5e74b8d0..f60208e04849 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/policy/PriorityUtilizationQueueOrderingPolicy.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/policy/PriorityUtilizationQueueOrderingPolicy.java
@@ -28,6 +28,7 @@ import 
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity
     .CapacitySchedulerConfiguration;
 import org.apache.hadoop.yarn.util.resource.Resources;
 
+import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
@@ -254,9 +255,9 @@ public class PriorityUtilizationQueueOrderingPolicy
     // partitionToLookAt is a thread local variable, therefore it is safe to 
mutate it.
     PriorityUtilizationQueueOrderingPolicy.partitionToLookAt.set(partition);
 
-    // Sort the snapshot of the queues in order to avoid breaking the 
prerequisites of TimSort.
-    // See YARN-10178 for details.
-    return queues.stream().map(PriorityQueueResourcesForSorting::new).sorted(
+    // Copy (for thread safety) and sort the snapshot of the queues in order 
to avoid breaking
+    // the prerequisites of TimSort. See YARN-10178 for details.
+    return new 
ArrayList<>(queues).stream().map(PriorityQueueResourcesForSorting::new).sorted(
         new 
PriorityQueueComparator()).map(PriorityQueueResourcesForSorting::getQueue).collect(
             Collectors.toList()).iterator();
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to