[
https://issues.apache.org/jira/browse/HDFS-16530?focusedWorklogId=753235&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753235
]
ASF GitHub Bot logged work on HDFS-16530:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 06/Apr/22 07:49
Start Date: 06/Apr/22 07:49
Worklog Time Spent: 10m
Work Description: sodonnel merged PR #4142:
URL: https://github.com/apache/hadoop/pull/4142
Issue Time Tracking
-------------------
Worklog Id: (was: 753235)
Time Spent: 40m (was: 0.5h)
> setReplication debug log creates a new string even if debug is disabled
> -----------------------------------------------------------------------
>
> Key: HDFS-16530
> URL: https://issues.apache.org/jira/browse/HDFS-16530
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: namenode
> Reporter: Stephen O'Donnell
> Assignee: Stephen O'Donnell
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> In FSDirAttrOp, HDFS-14521 made a good change to move a noisy logger to debug:
> {code}
> 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());
> }
> }
> {code}
> 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:
> {code}
> public String getPath() {
> if (pathname == null) {
> pathname = DFSUtil.byteArray2PathString(path);
> }
> return pathname;
> }
> {code}
> We should wrap the entire logging block in `if LOG.debugEnabled()` to avoid
> any overhead when the logger is not enabled.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]