You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2021/04/13 15:31:48 UTC
[hbase] branch branch-2.4 updated: HBASE-25762 Improvement for some
debug-logging guards (#3145)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 6c40def HBASE-25762 Improvement for some debug-logging guards (#3145)
6c40def is described below
commit 6c40def6d98ce0c1509b28803ec14b207830df5e
Author: ZhiChen <zi...@gmail.com>
AuthorDate: Tue Apr 13 23:03:55 2021 +0800
HBASE-25762 Improvement for some debug-logging guards (#3145)
Signed-off-by: Duo Zhang <zh...@apache.org>
---
.../org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java | 4 ++--
.../src/main/java/org/apache/hadoop/hbase/ChoreService.java | 10 ++++++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
index 2a2df8a..f31e3d2 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
@@ -150,9 +150,9 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler {
// to return a response. There is nothing we can do w/ the response at this stage. Clean
// out the wire of the response so its out of the way and we can get other responses on
// this connection.
- int readSoFar = IPCUtil.getTotalSizeWhenWrittenDelimited(responseHeader);
- int whatIsLeftToRead = totalSize - readSoFar;
if (LOG.isDebugEnabled()) {
+ int readSoFar = IPCUtil.getTotalSizeWhenWrittenDelimited(responseHeader);
+ int whatIsLeftToRead = totalSize - readSoFar;
LOG.debug("Unknown callId: " + id + ", skipping over this response of " + whatIsLeftToRead
+ " bytes");
}
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
index 5bd67ad..9540d84 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
@@ -403,6 +403,9 @@ public class ChoreService {
* Prints a summary of important details about the chore. Used for debugging purposes
*/
private void printChoreDetails(final String header, ScheduledChore chore) {
+ if (!LOG.isTraceEnabled()) {
+ return;
+ }
LinkedHashMap<String, String> output = new LinkedHashMap<>();
output.put(header, "");
output.put("Chore name: ", chore.getName());
@@ -410,7 +413,7 @@ public class ChoreService {
output.put("Chore timeBetweenRuns: ", Long.toString(chore.getTimeBetweenRuns()));
for (Entry<String, String> entry : output.entrySet()) {
- if (LOG.isTraceEnabled()) LOG.trace(entry.getKey() + entry.getValue());
+ LOG.trace(entry.getKey() + entry.getValue());
}
}
@@ -418,6 +421,9 @@ public class ChoreService {
* Prints a summary of important details about the service. Used for debugging purposes
*/
private void printChoreServiceDetails(final String header) {
+ if (!LOG.isTraceEnabled()) {
+ return;
+ }
LinkedHashMap<String, String> output = new LinkedHashMap<>();
output.put(header, "");
output.put("ChoreService corePoolSize: ", Integer.toString(getCorePoolSize()));
@@ -426,7 +432,7 @@ public class ChoreService {
Integer.toString(getNumberOfChoresMissingStartTime()));
for (Entry<String, String> entry : output.entrySet()) {
- if (LOG.isTraceEnabled()) LOG.trace(entry.getKey() + entry.getValue());
+ LOG.trace(entry.getKey() + entry.getValue());
}
}
}