当前位置: 首页>>代码示例>>Java>>正文


Java BlockCache.getBlockCount方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.io.hfile.BlockCache.getBlockCount方法的典型用法代码示例。如果您正苦于以下问题:Java BlockCache.getBlockCount方法的具体用法?Java BlockCache.getBlockCount怎么用?Java BlockCache.getBlockCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.io.hfile.BlockCache的用法示例。


在下文中一共展示了BlockCache.getBlockCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testClearBlockCache

import org.apache.hadoop.hbase.io.hfile.BlockCache; //导入方法依赖的package包/类
@Test
public void testClearBlockCache() throws Exception {
  BlockCache blockCache1 = rs1.getCacheConfig().getBlockCache();
  BlockCache blockCache2 = rs2.getCacheConfig().getBlockCache();

  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));
  clearRegionBlockCache(rs1);

  scanAllRegionsForRS(rs2);
  assertEquals(blockCache2.getBlockCount() - initialBlockCount2,
    HTU.getNumHFilesForRS(rs2, TABLE_NAME, FAMILY));
  clearRegionBlockCache(rs2);

  assertEquals(initialBlockCount1, blockCache1.getBlockCount());
  assertEquals(initialBlockCount2, blockCache2.getBlockCount());
}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestClearRegionBlockCache.java

示例2: testClearBlockCacheFromAdmin

import org.apache.hadoop.hbase.io.hfile.BlockCache; //导入方法依赖的package包/类
@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());
}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestClearRegionBlockCache.java

示例3: testClearBlockCacheFromAsyncAdmin

import org.apache.hadoop.hbase.io.hfile.BlockCache; //导入方法依赖的package包/类
@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());
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:TestClearRegionBlockCache.java


注:本文中的org.apache.hadoop.hbase.io.hfile.BlockCache.getBlockCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。