Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
In FSDirAttrOp, HDFS-14521 made a good change to move a noisy logger to debug:
if (oldBR > targetReplication) { FSDirectory.LOG.debug("Decreasing replication from {} to {} for {}", oldBR, targetReplication, iip.getPath()); } else if (oldBR < targetReplication) { FSDirectory.LOG.debug("Increasing replication from {} to {} for {}", oldBR, targetReplication, iip.getPath()); } else { FSDirectory.LOG.debug("Replication remains unchanged at {} for {}", oldBR, iip.getPath()); } }
However the `iip.getPath()` method must be evaluated to pass the resulting string into the LOG.debug method, even if debug is not enabled:
This code may form a new string where it does not need to:
public String getPath() { if (pathname == null) { pathname = DFSUtil.byteArray2PathString(path); } return pathname; }
We should wrap the entire logging block in `if LOG.debugEnabled()` to avoid any overhead when the logger is not enabled.
Attachments
Issue Links
- links to