HBASE-26444 BucketCacheWriter should log only the BucketAllocatorException message, not the full stack trace (#3840)

Signed-off-by: Anoop <anoopsamjohn@apache.org>
This commit is contained in:
Andrew Purtell 2021-11-15 16:11:53 -08:00 committed by GitHub
parent 69a4eda35f
commit d92e9089de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 12 deletions

View File

@ -1006,22 +1006,37 @@ public class BucketCache implements BlockCache, HeapSize {
/** /**
* Prepare and return a warning message for Bucket Allocator Exception * Prepare and return a warning message for Bucket Allocator Exception
* @param fle The exception
* @param re The RAMQueueEntry for which the exception was thrown. * @param re The RAMQueueEntry for which the exception was thrown.
* @return A warning message created from the input RAMQueueEntry object. * @return A warning message created from the input RAMQueueEntry object.
*/ */
private String getAllocationFailWarningMessage(RAMQueueEntry re) { private static String getAllocationFailWarningMessage(final BucketAllocatorException fle,
if (re != null && re.getData() instanceof HFileBlock) { final RAMQueueEntry re) {
HFileContext fileContext = ((HFileBlock) re.getData()).getHFileContext(); final StringBuilder sb = new StringBuilder();
String columnFamily = Bytes.toString(fileContext.getColumnFamily()); sb.append("Most recent failed allocation after ");
String tableName = Bytes.toString(fileContext.getTableName()); sb.append(ALLOCATION_FAIL_LOG_TIME_PERIOD);
if (tableName != null && columnFamily != null) { sb.append(" ms;");
return ("Most recent failed allocation in " + ALLOCATION_FAIL_LOG_TIME_PERIOD if (re != null) {
+ " milliseconds; Table Name = " + tableName + ", Column Family = " + columnFamily if (re.getData() instanceof HFileBlock) {
+ ", HFile Name : " + fileContext.getHFileName()); 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 sb.append(" Message: ");
+ " milliseconds; HFile Name : " + (re == null ? "" : re.getKey())); sb.append(fle.getMessage());
return sb.toString();
} }
/** /**
@ -1072,7 +1087,7 @@ public class BucketCache implements BlockCache, HeapSize {
long currTs = EnvironmentEdgeManager.currentTime(); long currTs = EnvironmentEdgeManager.currentTime();
cacheStats.allocationFailed(); // Record the warning. cacheStats.allocationFailed(); // Record the warning.
if (allocFailLogPrevTs == 0 || (currTs - allocFailLogPrevTs) > ALLOCATION_FAIL_LOG_TIME_PERIOD) { if (allocFailLogPrevTs == 0 || (currTs - allocFailLogPrevTs) > ALLOCATION_FAIL_LOG_TIME_PERIOD) {
LOG.warn (getAllocationFailWarningMessage(re), fle); LOG.warn(getAllocationFailWarningMessage(fle, re));
allocFailLogPrevTs = currTs; allocFailLogPrevTs = currTs;
} }
// Presume can't add. Too big? Move index on. Entry will be cleared from ramCache below. // Presume can't add. Too big? Move index on. Entry will be cleared from ramCache below.