sodonnel opened a new pull request, #4142:
URL: https://github.com/apache/hadoop/pull/4142

   ### Description of PR
   
   In FSDirAttrOp, 
[HDFS-14521](https://issues.apache.org/jira/browse/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.
   
   ### How was this patch tested?
   
   No new tests - simple change.
   
   


-- 
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