public CacheEvictionStatsBuilder append(CacheEvictionStats stats) { this.evictedBlocks += stats.getEvictedBlocks(); this.maxCacheSize += stats.getMaxCacheSize(); this.exceptions.putAll(stats.getExceptions()); return this; }
/** * {@inheritDoc} */ @Override public CacheEvictionStats clearBlockCache(final TableName tableName) throws IOException { checkTableExists(tableName); CacheEvictionStatsBuilder cacheEvictionStats = CacheEvictionStats.builder(); List<Pair<RegionInfo, ServerName>> pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName); Map<ServerName, List<RegionInfo>> regionInfoByServerName = pairs.stream() .filter(pair -> !(pair.getFirst().isOffline())) .filter(pair -> pair.getSecond() != null) .collect(Collectors.groupingBy(pair -> pair.getSecond(), Collectors.mapping(pair -> pair.getFirst(), Collectors.toList()))); for (Map.Entry<ServerName, List<RegionInfo>> entry : regionInfoByServerName.entrySet()) { CacheEvictionStats stats = clearBlockCache(entry.getKey(), entry.getValue()); cacheEvictionStats = cacheEvictionStats.append(stats); if (stats.getExceptionCount() > 0) { for (Map.Entry<byte[], Throwable> exception : stats.getExceptions().entrySet()) { LOG.debug("Failed to clear block cache for " + Bytes.toStringBinary(exception.getKey()) + " on " + entry.getKey() + ": ", exception.getValue()); } } } return cacheEvictionStats.build(); }
public static HBaseProtos.CacheEvictionStats toCacheEvictionStats( CacheEvictionStats cacheEvictionStats) { HBaseProtos.CacheEvictionStats.Builder builder = HBaseProtos.CacheEvictionStats.newBuilder(); for (Map.Entry<byte[], Throwable> entry : cacheEvictionStats.getExceptions().entrySet()) { builder.addException( RegionExceptionMessage.newBuilder() .setRegion(RequestConverter.buildRegionSpecifier( RegionSpecifierType.REGION_NAME, entry.getKey())) .setException(ResponseConverter.buildException(entry.getValue())) .build() ); } return builder .setEvictedBlocks(cacheEvictionStats.getEvictedBlocks()) .setMaxCacheSize(cacheEvictionStats.getMaxCacheSize()) .build(); }
public CacheEvictionStatsBuilder append(CacheEvictionStats stats) { this.evictedBlocks += stats.getEvictedBlocks(); this.maxCacheSize += stats.getMaxCacheSize(); this.exceptions.putAll(stats.getExceptions()); return this; }
/** * {@inheritDoc} */ @Override public CacheEvictionStats clearBlockCache(final TableName tableName) throws IOException { checkTableExists(tableName); CacheEvictionStatsBuilder cacheEvictionStats = CacheEvictionStats.builder(); List<Pair<RegionInfo, ServerName>> pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName); Map<ServerName, List<RegionInfo>> regionInfoByServerName = pairs.stream() .filter(pair -> !(pair.getFirst().isOffline())) .filter(pair -> pair.getSecond() != null) .collect(Collectors.groupingBy(pair -> pair.getSecond(), Collectors.mapping(pair -> pair.getFirst(), Collectors.toList()))); for (Map.Entry<ServerName, List<RegionInfo>> entry : regionInfoByServerName.entrySet()) { CacheEvictionStats stats = clearBlockCache(entry.getKey(), entry.getValue()); cacheEvictionStats = cacheEvictionStats.append(stats); if (stats.getExceptionCount() > 0) { for (Map.Entry<byte[], Throwable> exception : stats.getExceptions().entrySet()) { LOG.debug("Failed to clear block cache for " + Bytes.toStringBinary(exception.getKey()) + " on " + entry.getKey() + ": ", exception.getValue()); } } } return cacheEvictionStats.build(); }
public static HBaseProtos.CacheEvictionStats toCacheEvictionStats( CacheEvictionStats cacheEvictionStats) { HBaseProtos.CacheEvictionStats.Builder builder = HBaseProtos.CacheEvictionStats.newBuilder(); for (Map.Entry<byte[], Throwable> entry : cacheEvictionStats.getExceptions().entrySet()) { builder.addException( RegionExceptionMessage.newBuilder() .setRegion(RequestConverter.buildRegionSpecifier( RegionSpecifierType.REGION_NAME, entry.getKey())) .setException(ResponseConverter.buildException(entry.getValue())) .build() ); } return builder .setEvictedBlocks(cacheEvictionStats.getEvictedBlocks()) .setMaxCacheSize(cacheEvictionStats.getMaxCacheSize()) .build(); }
public CacheEvictionStatsBuilder append(CacheEvictionStats stats) { this.evictedBlocks += stats.getEvictedBlocks(); this.maxCacheSize += stats.getMaxCacheSize(); this.exceptions.putAll(stats.getExceptions()); return this; }
/** * {@inheritDoc} */ @Override public CacheEvictionStats clearBlockCache(final TableName tableName) throws IOException { checkTableExists(tableName); CacheEvictionStatsBuilder cacheEvictionStats = CacheEvictionStats.builder(); List<Pair<RegionInfo, ServerName>> pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName); Map<ServerName, List<RegionInfo>> regionInfoByServerName = pairs.stream() .filter(pair -> !(pair.getFirst().isOffline())) .filter(pair -> pair.getSecond() != null) .collect(Collectors.groupingBy(pair -> pair.getSecond(), Collectors.mapping(pair -> pair.getFirst(), Collectors.toList()))); for (Map.Entry<ServerName, List<RegionInfo>> entry : regionInfoByServerName.entrySet()) { CacheEvictionStats stats = clearBlockCache(entry.getKey(), entry.getValue()); cacheEvictionStats = cacheEvictionStats.append(stats); if (stats.getExceptionCount() > 0) { for (Map.Entry<byte[], Throwable> exception : stats.getExceptions().entrySet()) { LOG.debug("Failed to clear block cache for " + Bytes.toStringBinary(exception.getKey()) + " on " + entry.getKey() + ": ", exception.getValue()); } } } return cacheEvictionStats.build(); }
public static HBaseProtos.CacheEvictionStats toCacheEvictionStats( CacheEvictionStats cacheEvictionStats) { HBaseProtos.CacheEvictionStats.Builder builder = HBaseProtos.CacheEvictionStats.newBuilder(); for (Map.Entry<byte[], Throwable> entry : cacheEvictionStats.getExceptions().entrySet()) { builder.addException( RegionExceptionMessage.newBuilder() .setRegion(RequestConverter.buildRegionSpecifier( RegionSpecifierType.REGION_NAME, entry.getKey())) .setException(ResponseConverter.buildException(entry.getValue())) .build() ); } return builder .setEvictedBlocks(cacheEvictionStats.getEvictedBlocks()) .setMaxCacheSize(cacheEvictionStats.getMaxCacheSize()) .build(); }