Browse Source

HDFS-16530. setReplication debug log creates a new string even if debug is disabled (#4142)

(cherry picked from commit bbfe3500cf76ce661e0b10bb5d16cb419f9b9b10)
Stephen O'Donnell 3 years ago
parent
commit
bd0dbf319a

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java

@@ -408,7 +408,7 @@ public class FSDirAttrOp {
       bm.setReplication(oldBR, targetReplication, b);
     }
 
-    if (oldBR != -1) {
+    if (oldBR != -1 && FSDirectory.LOG.isDebugEnabled()) {
       if (oldBR > targetReplication) {
         FSDirectory.LOG.debug("Decreasing replication from {} to {} for {}",
                              oldBR, targetReplication, iip.getPath());