slfan1989 commented on code in PR #5193:
URL: https://github.com/apache/hadoop/pull/5193#discussion_r1048598592


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/rmadmin/FederationRMAdminInterceptor.java:
##########
@@ -192,11 +192,11 @@ public RefreshQueuesResponse 
refreshQueues(RefreshQueuesRequest request)
       }
     } catch (YarnException e) {
       routerMetrics.incrRefreshQueuesFailedRetrieved();
-      RouterServerUtil.logAndThrowException(e, "Unable to refreshQueue due to 
exception.");
+      throw e;

Review Comment:
   I found that if `Unable to refreshUserToGroupsMappings due to exception.` is 
directly displayed, the user still does not know why the exception occurred. It 
is better to display like this, `SC-2 is not an active subCluster.`, so I 
choose to throw the exception directly.
   
   Stack information before modification
   ```
   Caused by: org.apache.hadoop.yarn.exceptions.YarnException: Unable to 
refreshUserToGroupsMappings due to exception.
        at 
org.apache.hadoop.yarn.server.router.RouterServerUtil.logAndThrowException(RouterServerUtil.java:82)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.FederationRMAdminInterceptor.refreshUserToGroupsMappings(FederationRMAdminInterceptor.java:362)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.TestFederationRMAdminInterceptor.lambda$testSC1RefreshUserToGroupsMappings$7(TestFederationRMAdminInterceptor.java:260)
        at 
org.apache.hadoop.test.LambdaTestUtils.intercept(LambdaTestUtils.java:498)
        at 
org.apache.hadoop.test.LambdaTestUtils.intercept(LambdaTestUtils.java:384)
        at 
org.apache.hadoop.test.LambdaTestUtils.intercept(LambdaTestUtils.java:453)
        ... 30 more
   Caused by: org.apache.hadoop.yarn.exceptions.YarnException: subClusterId = 
SC-2 is not an active subCluster.
        at 
org.apache.hadoop.yarn.server.router.rmadmin.RMAdminProtocolMethod.invoke(RMAdminProtocolMethod.java:165)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.RMAdminProtocolMethod.invokeConcurrent(RMAdminProtocolMethod.java:69)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.FederationRMAdminInterceptor.refreshUserToGroupsMappings(FederationRMAdminInterceptor.java:352)
        ... 34 more
   ```
   
   I agree with you that we should log, so I'm going to modify it like this.
   
   ```
   org.apache.hadoop.yarn.exceptions.YarnException: Unable to 
refreshUserToGroupsMappings due to exception. subClusterId = SC-2 is not an 
active subCluster.
   
        at 
org.apache.hadoop.yarn.server.router.RouterServerUtil.logAndThrowException(RouterServerUtil.java:82)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.FederationRMAdminInterceptor.refreshUserToGroupsMappings(FederationRMAdminInterceptor.java:362)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.TestFederationRMAdminInterceptor.testSC1RefreshUserToGroupsMappings(TestFederationRMAdminInterceptor.java:258)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
        at 
com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
        at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
   Caused by: org.apache.hadoop.yarn.exceptions.YarnException: subClusterId = 
SC-NON is not an active subCluster.
        at 
org.apache.hadoop.yarn.server.router.rmadmin.RMAdminProtocolMethod.invoke(RMAdminProtocolMethod.java:165)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.RMAdminProtocolMethod.invokeConcurrent(RMAdminProtocolMethod.java:69)
        at 
org.apache.hadoop.yarn.server.router.rmadmin.FederationRMAdminInterceptor.refreshUserToGroupsMappings(FederationRMAdminInterceptor.java:352)
        ... 30 more
   
   ```
   



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to