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/17 14:40:35 UTC

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

ayushtkn commented on code in PR #5237:
URL: https://github.com/apache/hadoop/pull/5237#discussion_r1051411641


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



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