You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/12/19 03:11:36 UTC

[GitHub] [hadoop] Daniel-009497 commented on a diff in pull request #5237: HDFS-16870 HDFS client ip should also be logged when NameNode is processing reportBadBlocks

Daniel-009497 commented on code in PR #5237:
URL: https://github.com/apache/hadoop/pull/5237#discussion_r1051756290


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -5893,7 +5893,7 @@ void reportBadBlocks(LocatedBlock[] blocks) throws IOException {
         String[] storageIDs = blocks[i].getStorageIDs();
         for (int j = 0; j < nodes.length; j++) {
           NameNode.stateChangeLog.info("*DIR* reportBadBlocks for block: {} on"
-              + " datanode: {}", blk, nodes[j].getXferAddr());
+              + " datanode: {}" + " client: {}", blk, nodes[j].getXferAddr(), Server.getRemoteIp());

Review Comment:
   > Instead of `Server.getRemoteIp()`, do a `getClientMachine()` instead, it handles calls via RBF. Fetching of this IP Address should be outside lock, doing this inside lock will hit performance. You are logging this inside the loop, so better extract a variable outside.
   > 
   > reportBadBlocks is there in both ClientProtocol as well as in DatanodeProtocol. Can check somewhat here for pointers
   > 
   > https://github.com/apache/hadoop/blob/ca3526da9283500643479e784a779fb7898b6627/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java#L1533-L1534
   
   @ayushtkn @slfan1989  Thanks for reiew,  I moved getClientIp out of the for loop and write lock.
   and getClientMachine is not accessible here, this function always invoked by an open file.
   



-- 
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-unsubscribe@hadoop.apache.org

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


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