use of org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheConfiguration in project accumulo by apache.
the class TestLruBlockCache method testConfiguration.
public void testConfiguration() {
ConfigurationCopy cc = new ConfigurationCopy();
cc.set(Property.TSERV_CACHE_MANAGER_IMPL, LruBlockCacheManager.class.getName());
cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(1019));
cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(1000023));
cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(1000027));
cc.set(Property.TSERV_SUMMARYCACHE_SIZE, Long.toString(1000029));
LruBlockCacheConfiguration.builder(CacheType.INDEX).useEvictionThread(false).minFactor(0.93f).acceptableFactor(0.97f).singleFactor(0.20f).multiFactor(0.30f).memoryFactor(0.50f).mapConcurrencyLevel(5).buildMap().forEach(cc::set);
String defaultPrefix = BlockCacheManager.CACHE_PROPERTY_BASE + LruBlockCacheConfiguration.PROPERTY_PREFIX + ".default.";
// this should be overridden by cache type specific setting
cc.set(defaultPrefix + LruBlockCacheConfiguration.MEMORY_FACTOR_PROPERTY, "0.6");
// this is not set for the cache type, so should fall back to default
cc.set(defaultPrefix + LruBlockCacheConfiguration.MAP_LOAD_PROPERTY, "0.53");
BlockCacheConfiguration bcc = new BlockCacheConfiguration(cc);
LruBlockCacheConfiguration lbcc = new LruBlockCacheConfiguration(bcc, CacheType.INDEX);
assertEquals(false, lbcc.isUseEvictionThread());
assertEquals(0.93f, lbcc.getMinFactor());
assertEquals(0.97f, lbcc.getAcceptableFactor());
assertEquals(0.20f, lbcc.getSingleFactor());
assertEquals(0.30f, lbcc.getMultiFactor());
assertEquals(0.50f, lbcc.getMemoryFactor());
assertEquals(0.53f, lbcc.getMapLoadFactor());
assertEquals(5, lbcc.getMapConcurrencyLevel());
assertEquals(1019, lbcc.getBlockSize());
assertEquals(1000023, lbcc.getMaxSize());
}
Aggregations