Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/256#discussion_r115350017
--- 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 --
This behavior is kind of tricky. What if these properties were already set
in acuConf, what should the behavior be? The javadoc for BlockCacheFactory
would need to mention this behavior.
---
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.
---