haiyang1987 commented on PR #6094:
URL: https://github.com/apache/hadoop/pull/6094#issuecomment-1739132680

   > @goiri I am bit curious on removing the isDebugEnabled checks. Like here
   > 
   > ```
   > -          if (LOG.isDebugEnabled()) {
   > -            LOG.debug("syncBlock replicaInfo: block=" + block +
   > -                ", from datanode " + r.id + ", receivedState=" + 
rState.name() +
   > -                ", receivedLength=" + r.rInfo.getNumBytes() +
   > -                ", bestState=FINALIZED, finalizedLength=" + 
finalizedLength);
   > -          }
   > +          LOG.debug("syncBlock replicaInfo: block={}, from datanode {}, 
receivedState={}, " +
   > +              "receivedLength={}, bestState=FINALIZED, 
finalizedLength={}",
   > +              block, r.id, rState.name(), r.rInfo.getNumBytes(), 
finalizedLength);
   >          }
   > ```
   > 
   > There are method calls like `r.rInfo.getNumBytes()` these will be called & 
resolved irrespective whether debug logging is enabled or not, right? Even the 
concat on will be performed before passing to `LOG.debug`, Wouldn't it be 
better to have a `isDebug` gaurd where there are method calls or the log 
message is big & we use concat.
   > 
   > I am good with current as well
   
   Thanks @ayushtkn for your review.
   Indeed, it may be better to add if (`LOG.isDebugEnabled()`) here in terms of 
performance, If `LOG.isDebugEnabled `is false, it will not be called & resolved 
`r.rInfo.getNumBytes()`.
   view previous PRs https://github.com/apache/hadoop/pull/4480 and 
https://github.com/apache/hadoop/pull/4529 mentioned about Logging 
performance,there are method calls or the log message is large  & we use concat 
It may be better to use `DebugEnabled()` to judge.
   
   So here we maybe need to update the code and add `LOG.isDebugEnabled()`,what 
do you think about it ? @goiri @ayushtkn 
   
   


-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to