Browse Source

HDFS-17783. [ARR] Optimize the debug log of method asyncIpcClient to print concrete call info. (#7686). Contributed by hfutatzhanghb.

Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Reviewed-by: Shilun Fan <slfan1989@apache.org>
Signed-off-by: Jian Zhang <keepromise@apache.org>
hfutatzhanghb 3 weeks ago
parent
commit
1e6c225612

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/protocolPB/AsyncRpcProtocolPBUtil.java

@@ -26,6 +26,7 @@ import org.apache.hadoop.ipc.CallerContext;
 import org.apache.hadoop.ipc.Client;
 import org.apache.hadoop.ipc.ProtobufRpcEngine2;
 import org.apache.hadoop.ipc.ProtobufRpcEngineCallback2;
+import org.apache.hadoop.ipc.Server;
 import org.apache.hadoop.ipc.internal.ShadedProtobufHelper;
 import org.apache.hadoop.thirdparty.protobuf.Message;
 import org.apache.hadoop.util.concurrent.AsyncGet;
@@ -93,6 +94,8 @@ public final class AsyncRpcProtocolPBUtil {
       }
       try {
         T res = asyncReqMessage.get(-1, null);
+        LOG.debug("Async IPC Request, Call={}, CallerContext={}, Result={}",
+            Server.getCurCall().get(), CallerContext.getCurrent(), res);
         return response.apply(res);
       } catch (Exception ex) {
         throw warpCompletionException(ex);

+ 1 - 0
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ThreadLocalContext.java

@@ -75,6 +75,7 @@ public class ThreadLocalContext {
    * that the task execution reflects the state of the original calling thread.
    */
   public void transfer() {
+    Server.getCurCall().set(null);
     if (call != null) {
       Server.getCurCall().set(call);
     }