hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo Nicholas Sze (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-8971) Remove guards when calling LOG.debug() and LOG.trace() in client package
Date Fri, 06 Nov 2015 16:02:27 GMT

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

Tsz Wo Nicholas Sze commented on HDFS-8971:
-------------------------------------------

- Before the change
{code}
2015-11-06 23:56:12,610 [pool-1-thread-3] DEBUG util.ByteArrayManager (ByteArrayManager.java:logDebugMessage(48))
- allocate(225): count=2, belowThreshold, return byte[256]
2015-11-06 23:56:12,610 [pool-1-thread-6] DEBUG util.ByteArrayManager (ByteArrayManager.java:logDebugMessage(48))
- allocate(208): count=3, belowThreshold, return byte[256]
2015-11-06 23:56:12,610 [pool-1-thread-5] DEBUG util.ByteArrayManager (ByteArrayManager.java:logDebugMessage(48))
- allocate(7): count=1, belowThreshold, return byte[32]
2015-11-06 23:56:12,610 [pool-1-thread-8] DEBUG util.ByteArrayManager (ByteArrayManager.java:logDebugMessage(48))
- recycle: array.length=128, freeQueueSize=-1
{code}
- After the change
{code}
2015-11-06 23:50:52,202 [pool-1-thread-2] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(228)
2015-11-06 23:50:52,202 [pool-1-thread-1] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(110)
2015-11-06 23:50:52,204 [pool-1-thread-2] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(342))
- : count=1, belowThreshold
2015-11-06 23:50:52,205 [pool-1-thread-1] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(342))
- : count=1, belowThreshold
2015-11-06 23:50:52,206 [pool-1-thread-2] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(347))
- , return byte[256]
2015-11-06 23:50:52,206 [pool-1-thread-1] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(347))
- , return byte[128]
2015-11-06 23:50:52,299 [pool-1-thread-4] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(38)
2015-11-06 23:50:52,300 [pool-1-thread-7] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(63)
2015-11-06 23:50:52,299 [pool-1-thread-5] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(183)
2015-11-06 23:50:52,300 [pool-1-thread-11] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(87)
2015-11-06 23:50:52,300 [pool-1-thread-10] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(136)
2015-11-06 23:50:52,300 [pool-1-thread-9] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(71)
2015-11-06 23:50:52,300 [pool-1-thread-7] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(342))
- : count=2, belowThreshold
2015-11-06 23:50:52,301 [pool-1-thread-13] DEBUG util.ByteArrayManager (ByteArrayManager.java:release(362))
- recycle: array.length=128
2015-11-06 23:50:52,303 [pool-1-thread-13] DEBUG util.ByteArrayManager (ByteArrayManager.java:release(372))
- , freeQueueSize=-1
2015-11-06 23:50:52,300 [pool-1-thread-8] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(211)
2015-11-06 23:50:52,303 [pool-1-thread-8] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(342))
- : count=4, belowThreshold
2015-11-06 23:50:52,300 [pool-1-thread-6] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(114)
2015-11-06 23:50:52,300 [pool-1-thread-4] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(342))
- : count=1, belowThreshold
2015-11-06 23:50:52,300 [pool-1-thread-3] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(14)
2015-11-06 23:50:52,303 [pool-1-thread-4] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(347))
- , return byte[64]
2015-11-06 23:50:52,303 [pool-1-thread-6] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(342))
- : count=4, belowThreshold
2015-11-06 23:50:52,303 [pool-1-thread-8] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(347))
- , return byte[256]
2015-11-06 23:50:52,301 [pool-1-thread-18] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(143)
2015-11-06 23:50:52,301 [pool-1-thread-17] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(180)
2015-11-06 23:50:52,301 [pool-1-thread-16] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(133)
2015-11-06 23:50:52,301 [pool-1-thread-15] DEBUG util.ByteArrayManager (ByteArrayManager.java:newByteArray(328))
- allocate(121)
2015-11-06 23:50:52,301 [pool-1-thread-14] DEBUG util.ByteArrayManager (ByteArrayManager.java:release(362))
- recycle: array.length=256
{code}

> Remove guards when calling LOG.debug() and LOG.trace() in client package
> ------------------------------------------------------------------------
>
>                 Key: HDFS-8971
>                 URL: https://issues.apache.org/jira/browse/HDFS-8971
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: build
>            Reporter: Mingliang Liu
>            Assignee: Mingliang Liu
>             Fix For: 2.8.0
>
>         Attachments: HDFS-8971.000.patch, HDFS-8971.001.patch
>
>
> We moved the {{shortcircuit}} package from {{hadoop-hdfs}} to {{hadoop-hdfs-client}}
module in JIRA [HDFS-8934|https://issues.apache.org/jira/browse/HDFS-8934] and [HDFS-8951|https://issues.apache.org/jira/browse/HDFS-8951],
and {{BlockReader}} in [HDFS-8925|https://issues.apache.org/jira/browse/HDFS-8925]. Meanwhile,
we also replaced the _log4j_ log with _slf4j_ logger. There were existing code in the client
package to guard the log when calling {{LOG.debug()}} and {{LOG.trace()}}, e.g. in {{ShortCircuitCache.java}},
we have code like this:
> {code:title=Trace with guards|borderStyle=solid}
> 724    if (LOG.isTraceEnabled()) {
> 725      LOG.trace(this + ": found waitable for " + key);
> 726    }
> {code}
> In _slf4j_, this kind of guard is not necessary. We should clean the code by removing
the guard from the client package.
> {code:title=Trace without guards|borderStyle=solid}
> 724    LOG.trace("{}: found waitable for {}", this, key);
> {code}



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

Mime
View raw message