xinglin commented on code in PR #6234:
URL: https://github.com/apache/hadoop/pull/6234#discussion_r1378396847


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java:
##########
@@ -1849,8 +1849,8 @@ protected Subject getSubject() {
   @InterfaceStability.Evolving
   public <T> T doAs(PrivilegedAction<T> action) {
     if (LOG.isDebugEnabled()) {
-      LOG.debug("PrivilegedAction [as: {}][action: {}]", this, action,
-          new Exception());
+      LOG.debug("PrivilegedAction [as: {}][action: {}][from: {}]", this, 
action,
+              Thread.currentThread().getStackTrace()[2]);

Review Comment:
   Without your PR, we get the full stack trace. 
   
   ```
   23/10/30 14:31:39 DEBUG security.UserGroupInformation: PrivilegedAction [as: 
hive/[email protected] (auth:KERBEROS)][action: 
org.apache.hadoop.mapreduce.Job$10@5217f3d0]
   java.lang.Exception
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875)
        at org.apache.hadoop.mapreduce.Job.connect(Job.java:1536)
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:1565)
        at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1589)
        at org.apache.hadoop.mapreduce.SleepJob.run(SleepJob.java:290)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:81)
        at org.apache.hadoop.mapreduce.SleepJob.main(SleepJob.java:196)
        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.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:71)
        at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144)
        at 
org.apache.hadoop.test.MapredTestDriver.run(MapredTestDriver.java:139)
        at 
org.apache.hadoop.test.MapredTestDriver.main(MapredTestDriver.java:147)
        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.apache.hadoop.util.RunJar.run(RunJar.java:323)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
   23/10/30 14:31:39 DEBUG mapreduce.Cluster: Trying ClientProtocolProvider : 
org.apache.hadoop.mapred.YarnClientProtocolProvider
   ```
   
   With your PR, we only get to know the immediate parent function. 
   ```
   23/10/30 14:28:35 DEBUG security.UserGroupInformation: PrivilegedAction [as: 
hive/[email protected] (auth:KERBEROS)][action: 
org.apache.hadoop.mapreduce.Job$10@5217f3d0][from: 
org.apache.hadoop.mapreduce.Job.connect(Job.java:1536)]
   23/10/30 14:28:35 DEBUG mapreduce.Cluster: Trying ClientProtocolProvider : 
org.apache.hadoop.mapred.YarnClientProtocolProvider
   ```
   
   I agree the output is shorter. But how do we convince ourselves that 
additional call stack is not useful/needed? I do think these could be useful to 
know.



-- 
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]

Reply via email to