Search in sources :

Example 1 with CacheEvictionStatsBuilder

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();
}
Also used : ClearRegionBlockCacheResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearRegionBlockCacheResponse) BlockCache(org.apache.hadoop.hbase.io.hfile.BlockCache) CacheEvictionStatsBuilder(org.apache.hadoop.hbase.CacheEvictionStatsBuilder) FailedSanityCheckException(org.apache.hadoop.hbase.exceptions.FailedSanityCheckException) ResultOrException(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ResultOrException) ScannerResetException(org.apache.hadoop.hbase.exceptions.ScannerResetException) OutOfOrderScannerNextException(org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException) RegionTooBusyException(org.apache.hadoop.hbase.RegionTooBusyException) IOException(java.io.IOException) LeaseStillHeldException(org.apache.hadoop.hbase.regionserver.LeaseManager.LeaseStillHeldException) NotServingRegionException(org.apache.hadoop.hbase.NotServingRegionException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) ServerNotRunningYetException(org.apache.hadoop.hbase.ipc.ServerNotRunningYetException) UnknownProtocolException(org.apache.hadoop.hbase.exceptions.UnknownProtocolException) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) UncheckedIOException(java.io.UncheckedIOException) UnknownScannerException(org.apache.hadoop.hbase.UnknownScannerException) FileNotFoundException(java.io.FileNotFoundException) BindException(java.net.BindException) DroppedSnapshotException(org.apache.hadoop.hbase.DroppedSnapshotException)

Example 2 with CacheEvictionStatsBuilder

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();
}
Also used : RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier) CacheEvictionStatsBuilder(org.apache.hadoop.hbase.CacheEvictionStatsBuilder) HBaseProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos) RegionExceptionMessage(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionExceptionMessage)

Aggregations

CacheEvictionStatsBuilder (org.apache.hadoop.hbase.CacheEvictionStatsBuilder)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 BindException (java.net.BindException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 DroppedSnapshotException (org.apache.hadoop.hbase.DroppedSnapshotException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 NotServingRegionException (org.apache.hadoop.hbase.NotServingRegionException)1 RegionTooBusyException (org.apache.hadoop.hbase.RegionTooBusyException)1 UnknownScannerException (org.apache.hadoop.hbase.UnknownScannerException)1 FailedSanityCheckException (org.apache.hadoop.hbase.exceptions.FailedSanityCheckException)1 OutOfOrderScannerNextException (org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException)1 ScannerResetException (org.apache.hadoop.hbase.exceptions.ScannerResetException)1 UnknownProtocolException (org.apache.hadoop.hbase.exceptions.UnknownProtocolException)1 BlockCache (org.apache.hadoop.hbase.io.hfile.BlockCache)1 ServerNotRunningYetException (org.apache.hadoop.hbase.ipc.ServerNotRunningYetException)1 LeaseStillHeldException (org.apache.hadoop.hbase.regionserver.LeaseManager.LeaseStillHeldException)1 ClearRegionBlockCacheResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearRegionBlockCacheResponse)1 ResultOrException (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ResultOrException)1