public CacheEvictionStatsBuilder append(CacheEvictionStats stats) { this.evictedBlocks += stats.getEvictedBlocks(); this.maxCacheSize += stats.getMaxCacheSize(); this.exceptions.putAll(stats.getExceptions()); return this; }
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(); }
@Test public void testClearBlockCacheFromAsyncAdmin() throws Exception { AsyncAdmin admin = ConnectionFactory.createAsyncConnection(HTU.getConfiguration()).get().getAdmin(); BlockCache blockCache1 = rs1.getBlockCache().get(); BlockCache blockCache2 = rs2.getBlockCache().get(); long initialBlockCount1 = blockCache1.getBlockCount(); long initialBlockCount2 = blockCache2.getBlockCount(); // scan will cause blocks to be added in BlockCache scanAllRegionsForRS(rs1); assertEquals(blockCache1.getBlockCount() - initialBlockCount1, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY)); scanAllRegionsForRS(rs2); assertEquals(blockCache2.getBlockCount() - initialBlockCount2, HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); CacheEvictionStats stats = admin.clearBlockCache(TABLE_NAME).get(); assertEquals(stats.getEvictedBlocks(), HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU .getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); assertEquals(initialBlockCount1, blockCache1.getBlockCount()); assertEquals(initialBlockCount2, blockCache2.getBlockCount()); }
@Test public void testClearBlockCacheFromAdmin() throws Exception { Admin admin = HTU.getAdmin(); BlockCache blockCache1 = rs1.getBlockCache().get(); BlockCache blockCache2 = rs2.getBlockCache().get(); long initialBlockCount1 = blockCache1.getBlockCount(); long initialBlockCount2 = blockCache2.getBlockCount(); // scan will cause blocks to be added in BlockCache scanAllRegionsForRS(rs1); assertEquals(blockCache1.getBlockCount() - initialBlockCount1, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY)); scanAllRegionsForRS(rs2); assertEquals(blockCache2.getBlockCount() - initialBlockCount2, HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); CacheEvictionStats stats = admin.clearBlockCache(TABLE_NAME); assertEquals(stats.getEvictedBlocks(), HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); assertEquals(initialBlockCount1, blockCache1.getBlockCount()); assertEquals(initialBlockCount2, blockCache2.getBlockCount()); }
public CacheEvictionStatsBuilder append(CacheEvictionStats stats) { this.evictedBlocks += stats.getEvictedBlocks(); this.maxCacheSize += stats.getMaxCacheSize(); this.exceptions.putAll(stats.getExceptions()); return this; }
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; }
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(); }
@Test public void testClearBlockCacheFromAsyncAdmin() throws Exception { AsyncAdmin admin = ConnectionFactory.createAsyncConnection(HTU.getConfiguration()).get().getAdmin(); // All RS run in a same process, so the block cache is same for rs1 and rs2 BlockCache blockCache = rs1.getCacheConfig().getBlockCache(); long initialBlockCount = blockCache.getBlockCount(); // scan will cause blocks to be added in BlockCache scanAllRegionsForRS(rs1); assertEquals(blockCache.getBlockCount() - initialBlockCount, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY)); scanAllRegionsForRS(rs2); assertEquals(blockCache.getBlockCount() - initialBlockCount, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); CacheEvictionStats stats = admin.clearBlockCache(TABLE_NAME).get(); assertEquals(stats.getEvictedBlocks(), HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); assertEquals(initialBlockCount, blockCache.getBlockCount()); }
@Test public void testClearBlockCacheFromAdmin() throws Exception { Admin admin = HTU.getAdmin(); // All RS run in a same process, so the block cache is same for rs1 and rs2 BlockCache blockCache = rs1.getCacheConfig().getBlockCache(); long initialBlockCount = blockCache.getBlockCount(); // scan will cause blocks to be added in BlockCache scanAllRegionsForRS(rs1); assertEquals(blockCache.getBlockCount() - initialBlockCount, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY)); scanAllRegionsForRS(rs2); assertEquals(blockCache.getBlockCount() - initialBlockCount, HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); CacheEvictionStats stats = admin.clearBlockCache(TABLE_NAME); assertEquals(stats.getEvictedBlocks(), HTU.getNumHFilesForRS(rs1, TABLE_NAME, FAMILY) + HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY)); assertEquals(initialBlockCount, blockCache.getBlockCount()); }