Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/256#discussion_r115354600
--- Diff:
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
---
@@ -175,19 +176,27 @@ public TabletServerResourceManager(TabletServer
tserver, VolumeManager fs) {
long sCacheSize = acuConf.getAsBytes(Property.TSERV_SUMMARYCACHE_SIZE);
long totalQueueSize =
acuConf.getAsBytes(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX);
- String policy = acuConf.get(Property.TSERV_CACHE_POLICY);
- if (policy.equalsIgnoreCase("LRU")) {
- _iCache = new LruBlockCache(iCacheSize, blockSize);
- _dCache = new LruBlockCache(dCacheSize, blockSize);
- _sCache = new LruBlockCache(sCacheSize, blockSize);
- } else if (policy.equalsIgnoreCase("TinyLFU")) {
- _iCache = new TinyLfuBlockCache(iCacheSize, blockSize);
- _dCache = new TinyLfuBlockCache(dCacheSize, blockSize);
- _sCache = new TinyLfuBlockCache(sCacheSize, blockSize);
- } else {
- throw new IllegalArgumentException("Unknown Block cache policy " +
policy);
+ BlockCacheFactory factory;
+ try {
+ factory = BlockCacheFactory.getBlockCacheFactory(acuConf);
+ } catch (Exception e) {
+ throw new RuntimeException("Error creating Block Cache Factory", e);
}
+ ConfigurationCopy copy = new ConfigurationCopy(acuConf);
+ copy.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY,
Long.toString(blockSize));
+ copy.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY,
Long.toString(iCacheSize));
--- End diff --
@dlmarion did you see my earlier comment about having a CacheType enum?
That could make the need for this to go away. The constuctor for
`BlockCacheFactory` could take a `CacheType` and use it to get the correct max
size property.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---