[ 
https://issues.apache.org/jira/browse/HDFS-9618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15564882#comment-15564882
 ] 

Akira Ajisaka commented on HDFS-9618:
-------------------------------------

In the following code, isDebugEnabled is necessary because we can avoid 
creating targetList when the log level is not debug or trace.
{code:title=BlockManager.java}
    if (blockLog.isDebugEnabled()) {
      // log which blocks have been scheduled for reconstruction
      for(BlockReconstructionWork rw : reconWork){
        DatanodeStorageInfo[] targets = rw.getTargets();
        if (targets != null && targets.length != 0) {
          StringBuilder targetList = new StringBuilder("datanode(s)");
          for (DatanodeStorageInfo target : targets) {
            targetList.append(' ');
            targetList.append(target.getDatanodeDescriptor());
          }
          blockLog.debug("BLOCK* ask {} to replicate {} to {}", 
rw.getSrcNodes(),
              rw.getBlock(), targetList);
        }
      }
{code}

> Fix mismatch between log level and guard in 
> BlockManager#computeRecoveryWorkForBlocks
> -------------------------------------------------------------------------------------
>
>                 Key: HDFS-9618
>                 URL: https://issues.apache.org/jira/browse/HDFS-9618
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.8.0
>            Reporter: Masatake Iwasaki
>            Assignee: Masatake Iwasaki
>            Priority: Minor
>             Fix For: 2.9.0, 3.0.0-alpha1
>
>         Attachments: HDFS-9618.001.patch, HDFS-9618.002.patch
>
>
> Debug log message is constructed when {{Logger#isInfoEnabled}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to