Search in sources :

Example 1 with IndexOnlyLruBlockCache

use of org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache in project hbase by apache.

the class TestClientSideRegionScanner method testDefaultBlockCache.

@Test
public void testDefaultBlockCache() throws IOException {
    Configuration copyConf = new Configuration(conf);
    ClientSideRegionScanner clientSideRegionScanner = new ClientSideRegionScanner(copyConf, fs, rootDir, htd, hri, scan, null);
    BlockCache blockCache = clientSideRegionScanner.getRegion().getBlockCache();
    assertNotNull(blockCache);
    assertTrue(blockCache instanceof IndexOnlyLruBlockCache);
    assertTrue(HConstants.HBASE_CLIENT_SCANNER_ONHEAP_BLOCK_CACHE_FIXED_SIZE_DEFAULT == blockCache.getMaxSize());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) IndexOnlyLruBlockCache(org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache) BlockCache(org.apache.hadoop.hbase.io.hfile.BlockCache) IndexOnlyLruBlockCache(org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache) Test(org.junit.Test)

Example 2 with IndexOnlyLruBlockCache

use of org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache in project hbase by apache.

the class TestClientSideRegionScanner method testConfiguredBlockCache.

@Test
public void testConfiguredBlockCache() throws IOException {
    Configuration copyConf = new Configuration(conf);
    // tiny 1MB fixed cache size
    long blockCacheFixedSize = 1024 * 1024L;
    copyConf.setLong(HConstants.HFILE_ONHEAP_BLOCK_CACHE_FIXED_SIZE_KEY, blockCacheFixedSize);
    ClientSideRegionScanner clientSideRegionScanner = new ClientSideRegionScanner(copyConf, fs, rootDir, htd, hri, scan, null);
    BlockCache blockCache = clientSideRegionScanner.getRegion().getBlockCache();
    assertNotNull(blockCache);
    assertTrue(blockCache instanceof IndexOnlyLruBlockCache);
    assertTrue(blockCacheFixedSize == blockCache.getMaxSize());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) IndexOnlyLruBlockCache(org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache) BlockCache(org.apache.hadoop.hbase.io.hfile.BlockCache) IndexOnlyLruBlockCache(org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)2 BlockCache (org.apache.hadoop.hbase.io.hfile.BlockCache)2 IndexOnlyLruBlockCache (org.apache.hadoop.hbase.io.hfile.IndexOnlyLruBlockCache)2 Test (org.junit.Test)2