HBASE-14891 Add log for uncaught exception in RegionServerMetricsWrapperRunnable(Yu Li)

This commit is contained in:
chenheng 2015-11-30 22:30:09 +08:00
parent 71d41e0c9c
commit 999ae69155
1 changed files with 146 additions and 141 deletions

View File

@ -569,6 +569,7 @@ class MetricsRegionServerWrapperImpl
@Override @Override
synchronized public void run() { synchronized public void run() {
try {
initBlockCache(); initBlockCache();
initMobFileCache(); initMobFileCache();
cacheStats = blockCache.getStats(); cacheStats = blockCache.getStats();
@ -655,8 +656,8 @@ class MetricsRegionServerWrapperImpl
float localityIndexSecondaryRegions = hdfsBlocksDistributionSecondaryRegions float localityIndexSecondaryRegions = hdfsBlocksDistributionSecondaryRegions
.getBlockLocalityIndex(regionServer.getServerName().getHostname()); .getBlockLocalityIndex(regionServer.getServerName().getHostname());
tempPercentFileLocalSecondaryRegions = tempPercentFileLocalSecondaryRegions = Double.
Double.isNaN(localityIndexSecondaryRegions) ? 0 : (localityIndexSecondaryRegions * 100); isNaN(localityIndexSecondaryRegions) ? 0 : (localityIndexSecondaryRegions * 100);
// Compute the number of requests per second // Compute the number of requests per second
long currentTime = EnvironmentEdgeManager.currentTime(); long currentTime = EnvironmentEdgeManager.currentTime();
@ -714,10 +715,14 @@ class MetricsRegionServerWrapperImpl
mobScanCellsSize = tempMobScanCellsSize; mobScanCellsSize = tempMobScanCellsSize;
mobFileCacheAccessCount = mobFileCache.getAccessCount(); mobFileCacheAccessCount = mobFileCache.getAccessCount();
mobFileCacheMissCount = mobFileCache.getMissCount(); mobFileCacheMissCount = mobFileCache.getMissCount();
mobFileCacheHitRatio = Double.isNaN(mobFileCache.getHitRatio())?0:mobFileCache.getHitRatio(); mobFileCacheHitRatio = Double.
isNaN(mobFileCache.getHitRatio())?0:mobFileCache.getHitRatio();
mobFileCacheEvictedCount = mobFileCache.getEvictedFileCount(); mobFileCacheEvictedCount = mobFileCache.getEvictedFileCount();
mobFileCacheCount = mobFileCache.getCacheSize(); mobFileCacheCount = mobFileCache.getCacheSize();
blockedRequestsCount = tempBlockedRequestsCount; blockedRequestsCount = tempBlockedRequestsCount;
} catch (Throwable e) {
LOG.warn("Caught exception! Will suppress and retry.", e);
}
} }
} }