From 38d87883b6d4fe6a974e99b937b03cab55bc3820 Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Thu, 12 Mar 2020 12:18:37 +0100 Subject: [PATCH] YARN-10193. FS-CS converter: fix incorrect capacity conversion. Contributed by Peter Bacsko --- .../scheduler/fair/converter/FSQueueConverter.java | 2 +- .../scheduler/fair/converter/TestFSQueueConverter.java | 2 +- 2 files changed, 2 insertions(+), 2 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/fair/converter/FSQueueConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java index 8fd10f5e7a..adc6bfda44 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java @@ -359,7 +359,7 @@ private Map getCapacities(int totalWeight, // fix last value if total != 100.000 if (!totalPct.equals(hundred)) { BigDecimal tmp = new BigDecimal(0); - for (int i = 0; i < children.size() - 2; i++) { + for (int i = 0; i < children.size() - 1; i++) { tmp = tmp.add(capacities.get(children.get(i).getQueueName())); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java index 580fbaa941..c35bf8e1af 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java @@ -296,7 +296,7 @@ public void testChildCapacity() { csConfig.get(PREFIX + "root.default.capacity")); assertEquals("root.admins capacity", "33.333", csConfig.get(PREFIX + "root.admins.capacity")); - assertEquals("root.users capacity", "66.667", + assertEquals("root.users capacity", "33.334", csConfig.get(PREFIX + "root.users.capacity")); // root.users