From 43db94c7a30f14c7fdad06f07a16889b9a29d5be Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Mon, 10 May 2021 17:09:51 +0530 Subject: [PATCH] HDFS-16003. ProcessReport print invalidatedBlocks should judge debug level at first. Contributed by lei w. --- .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 6fd23439dd..0132e38619 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -2794,9 +2794,12 @@ public boolean processReport(final DatanodeID nodeID, namesystem.writeUnlock(); } - for (Block b : invalidatedBlocks) { - blockLog.debug("BLOCK* processReport 0x{}: {} on node {} size {} does not" - + " belong to any file", strBlockReportId, b, node, b.getNumBytes()); + if(blockLog.isDebugEnabled()) { + for (Block b : invalidatedBlocks) { + blockLog.debug("BLOCK* processReport 0x{}: {} on node {} size {} " + + "does not belong to any file.", strBlockReportId, b, + node, b.getNumBytes()); + } } // Log the block report processing stats from Namenode perspective