You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by qu...@apache.org on 2022/09/09 12:39:03 UTC

[hadoop] branch trunk updated: YARN-11278. Fixed Ambiguous error message in mutation API. Contributed by Ashutosh Gupta.

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

quapaw pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 5b85af87f0e YARN-11278. Fixed Ambiguous error message in mutation API. Contributed by Ashutosh Gupta.
5b85af87f0e is described below

commit 5b85af87f0edeaded5f91c1b3317ddbf67d11d36
Author: 9uapaw <gy...@gmail.com>
AuthorDate: Fri Sep 9 14:38:41 2022 +0200

    YARN-11278. Fixed Ambiguous error message in mutation API. Contributed by Ashutosh Gupta.
---
 .../server/resourcemanager/webapp/RMWebServices.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 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/webapp/RMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java
index 26c921796b3..6a6a2e1de1e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java
@@ -2748,26 +2748,26 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol {
     initForWritableEndpoints(callerUGI, true);
 
     ResourceScheduler scheduler = rm.getResourceScheduler();
-    if (isConfigurationMutable(scheduler)) {
+    if (!(scheduler instanceof MutableConfScheduler)) {
+      return Response.status(Status.BAD_REQUEST)
+          .entity("Configuration change only supported by MutableConfScheduler.").build();
+    } else if (!((MutableConfScheduler) scheduler).isConfigurationMutable()) {
+      return Response.status(Status.BAD_REQUEST)
+          .entity("Configuration change only supported by mutable configuration store.").build();
+    } else {
       try {
         callerUGI.doAs((PrivilegedExceptionAction<Void>) () -> {
-          MutableConfigurationProvider provider = ((MutableConfScheduler)
-              scheduler).getMutableConfProvider();
+          MutableConfigurationProvider provider =
+              ((MutableConfScheduler) scheduler).getMutableConfProvider();
           LogMutation logMutation = applyMutation(provider, callerUGI, mutationInfo);
           return refreshQueues(provider, logMutation);
         });
       } catch (IOException e) {
         LOG.error("Exception thrown when modifying configuration.", e);
-        return Response.status(Status.BAD_REQUEST).entity(e.getMessage())
-            .build();
+        return Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
       }
       return Response.status(Status.OK).entity("Configuration change successfully applied.")
           .build();
-    } else {
-      return Response.status(Status.BAD_REQUEST)
-          .entity(String.format("Configuration change only supported by " +
-              "%s.", MutableConfScheduler.class.getSimpleName()))
-          .build();
     }
   }
 


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