You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2021/11/16 00:17:21 UTC
[hbase] branch branch-2 updated: HBASE-26444 BucketCacheWriter should log only the BucketAllocatorException message, not the full stack trace (#3840)
This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new e65f28c HBASE-26444 BucketCacheWriter should log only the BucketAllocatorException message, not the full stack trace (#3840)
e65f28c is described below
commit e65f28cc57caf84ada72c94353cb2620bc6ef3ed
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Mon Nov 15 16:11:53 2021 -0800
HBASE-26444 BucketCacheWriter should log only the BucketAllocatorException message, not the full stack trace (#3840)
Signed-off-by: Anoop <an...@apache.org>
---
.../hadoop/hbase/io/hfile/bucket/BucketCache.java | 39 +++++++++++++++-------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
index a41570d..5f8869a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
@@ -995,22 +995,37 @@ public class BucketCache implements BlockCache, HeapSize {
/**
* Prepare and return a warning message for Bucket Allocator Exception
+ * @param fle The exception
* @param re The RAMQueueEntry for which the exception was thrown.
* @return A warning message created from the input RAMQueueEntry object.
*/
- private String getAllocationFailWarningMessage(RAMQueueEntry re) {
- if (re != null && re.getData() instanceof HFileBlock) {
- HFileContext fileContext = ((HFileBlock) re.getData()).getHFileContext();
- String columnFamily = Bytes.toString(fileContext.getColumnFamily());
- String tableName = Bytes.toString(fileContext.getTableName());
- if (tableName != null && columnFamily != null) {
- return ("Most recent failed allocation in " + ALLOCATION_FAIL_LOG_TIME_PERIOD
- + " milliseconds; Table Name = " + tableName + ", Column Family = " + columnFamily
- + ", HFile Name : " + fileContext.getHFileName());
+ private static String getAllocationFailWarningMessage(final BucketAllocatorException fle,
+ final RAMQueueEntry re) {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("Most recent failed allocation after ");
+ sb.append(ALLOCATION_FAIL_LOG_TIME_PERIOD);
+ sb.append(" ms;");
+ if (re != null) {
+ if (re.getData() instanceof HFileBlock) {
+ final HFileContext fileContext = ((HFileBlock) re.getData()).getHFileContext();
+ final String columnFamily = Bytes.toString(fileContext.getColumnFamily());
+ final String tableName = Bytes.toString(fileContext.getTableName());
+ if (tableName != null && columnFamily != null) {
+ sb.append(" Table: ");
+ sb.append(tableName);
+ sb.append(" CF: ");
+ sb.append(columnFamily);
+ sb.append(" HFile: ");
+ sb.append(fileContext.getHFileName());
+ }
+ } else {
+ sb.append(" HFile: ");
+ sb.append(re.getKey());
}
}
- return ("Most recent failed allocation in " + ALLOCATION_FAIL_LOG_TIME_PERIOD
- + " milliseconds; HFile Name : " + (re == null ? "" : re.getKey()));
+ sb.append(" Message: ");
+ sb.append(fle.getMessage());
+ return sb.toString();
}
/**
@@ -1061,7 +1076,7 @@ public class BucketCache implements BlockCache, HeapSize {
long currTs = EnvironmentEdgeManager.currentTime();
cacheStats.allocationFailed(); // Record the warning.
if (allocFailLogPrevTs == 0 || (currTs - allocFailLogPrevTs) > ALLOCATION_FAIL_LOG_TIME_PERIOD) {
- LOG.warn (getAllocationFailWarningMessage(re), fle);
+ LOG.warn(getAllocationFailWarningMessage(fle, re));
allocFailLogPrevTs = currTs;
}
// Presume can't add. Too big? Move index on. Entry will be cleared from ramCache below.