use of org.apache.hadoop.hbase.CacheEvictionStatsBuilder in project hbase by apache.
the class RSRpcServices method clearRegionBlockCache.
@Override
public ClearRegionBlockCacheResponse clearRegionBlockCache(RpcController controller, ClearRegionBlockCacheRequest request) throws ServiceException {
rpcPreCheck("clearRegionBlockCache");
ClearRegionBlockCacheResponse.Builder builder = ClearRegionBlockCacheResponse.newBuilder();
CacheEvictionStatsBuilder stats = CacheEvictionStats.builder();
List<HRegion> regions = getRegions(request.getRegionList(), stats);
for (HRegion region : regions) {
try {
stats = stats.append(this.server.clearRegionBlockCache(region));
} catch (Exception e) {
stats.addException(region.getRegionInfo().getRegionName(), e);
}
}
stats.withMaxCacheSize(server.getBlockCache().map(BlockCache::getMaxSize).orElse(0L));
return builder.setStats(ProtobufUtil.toCacheEvictionStats(stats.build())).build();
}
use of org.apache.hadoop.hbase.CacheEvictionStatsBuilder in project hbase by apache.
the class ProtobufUtil method toCacheEvictionStats.
public static CacheEvictionStats toCacheEvictionStats(HBaseProtos.CacheEvictionStats stats) throws IOException {
CacheEvictionStatsBuilder builder = CacheEvictionStats.builder();
builder.withEvictedBlocks(stats.getEvictedBlocks()).withMaxCacheSize(stats.getMaxCacheSize());
if (stats.getExceptionCount() > 0) {
for (HBaseProtos.RegionExceptionMessage exception : stats.getExceptionList()) {
HBaseProtos.RegionSpecifier rs = exception.getRegion();
byte[] regionName = rs.getValue().toByteArray();
builder.addException(regionName, ProtobufUtil.toException(exception.getException()));
}
}
return builder.build();
}
Aggregations