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 review,  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: [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