HDFS-16870 HDFS client ip should also be logged when NameNode is processing reportBadBlocks

This commit is contained in:
Daniel-009497 2022-12-17 18:01:08 +08:00
parent ca3526da92
commit 05137dd0ff
1 changed files with 2 additions and 1 deletions

View File

@ -5884,6 +5884,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
*/
void reportBadBlocks(LocatedBlock[] blocks) throws IOException {
checkOperation(OperationCategory.WRITE);
InetAddress remoteIp = Server.getRemoteIp();
writeLock();
try {
checkOperation(OperationCategory.WRITE);
@ -5893,7 +5894,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
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(), remoteIp);
blockManager.findAndMarkBlockAsCorrupt(blk, nodes[j],
storageIDs == null ? null: storageIDs[j],
"client machine reported it");