Skip to content

Commit

Permalink
HBASE-26190 High rate logging of BucketAllocatorException: Allocation…
Browse files Browse the repository at this point in the history
… too big - Addendum (apache#3792)
  • Loading branch information
anoopsjohn authored Oct 24, 2021
1 parent 9e47358 commit 84a527b
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1011,16 +1011,17 @@ protected void putIntoBackingMap(BlockCacheKey key, BucketEntry bucketEntry) {
*/
private String getAllocationFailWarningMessage(RAMQueueEntry re) {
if (re != null && re.getData() instanceof HFileBlock) {
HFileBlock block = (HFileBlock) re.getData();
HFileContext fileContext = block.getHFileContext();
String hFileName = fileContext.getHFileName();
HFileContext fileContext = ((HFileBlock) re.getData()).getHFileContext();
String columnFamily = Bytes.toString(fileContext.getColumnFamily());
String tableName = Bytes.toString(fileContext.getTableName());
return ("Most recent failed allocation in " + ALLOCATION_FAIL_LOG_TIME_PERIOD
+ " milliseconds; Table Name = " + tableName + ", Column Family = "
+ columnFamily + ", HFile Name : " + hFileName);
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());
}
}
return ("Failed allocation for " + (re == null ? "" : re.getKey()) + "; ");
return ("Most recent failed allocation in " + ALLOCATION_FAIL_LOG_TIME_PERIOD
+ " milliseconds; HFile Name : " + (re == null ? "" : re.getKey()));
}

/**
Expand Down Expand Up @@ -1068,7 +1069,7 @@ void doDrain(final List<RAMQueueEntry> entries) throws InterruptedException {
}
index++;
} catch (BucketAllocatorException fle) {
long currTs = System.currentTimeMillis(); // Current time since Epoch in milliseconds.
long currTs = EnvironmentEdgeManager.currentTime();
cacheStats.allocationFailed(); // Record the warning.
if (allocFailLogPrevTs == 0 || (currTs - allocFailLogPrevTs) > ALLOCATION_FAIL_LOG_TIME_PERIOD) {
LOG.warn (getAllocationFailWarningMessage(re), fle);
Expand Down

0 comments on commit 84a527b

Please sign in to comment.