Github user mjwall commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/256#discussion_r116022505
--- Diff:
core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java ---
@@ -135,16 +140,35 @@ public long requestCount() {
}
this.opts = opts;
- if (opts.indexCacheSize > 0) {
- this.indexCache = new LruBlockCache(opts.indexCacheSize,
CACHE_BLOCK_SIZE);
- } else {
- this.indexCache = new NoopCache();
- }
- if (opts.dataCacheSize > 0) {
- this.dataCache = new LruBlockCache(opts.dataCacheSize,
CACHE_BLOCK_SIZE);
- } else {
- this.dataCache = new NoopCache();
+ if (opts.indexCacheSize > 0 || opts.dataCacheSize > 0) {
+ ConfigurationCopy cc = null;
+ if (null != opts.tableConfig) {
+ cc = new ConfigurationCopy(opts.tableConfig);
+ } else {
+ cc = new ConfigurationCopy(new DefaultConfiguration());
+ }
+ cc.set(Property.TSERV_DEFAULT_BLOCKSIZE,
Long.toString(CACHE_BLOCK_SIZE));
+ try {
+ factory = BlockCacheManager.getInstance(cc);
+ } catch (Exception e) {
+ throw new RuntimeException("Error creating BlockCacheFactory", e);
+ }
+ if (opts.indexCacheSize > 0) {
+ cc.set(Property.TSERV_INDEXCACHE_SIZE,
Long.toString(opts.indexCacheSize));
+ }
+ if (opts.dataCacheSize > 0) {
+ cc.set(Property.TSERV_DATACACHE_SIZE,
Long.toString(opts.dataCacheSize));
+ }
+ factory.start(cc);
+ this.indexCache = factory.getBlockCache(CacheType.INDEX);
+ if (null == indexCache) {
--- End diff --
Could factory.getBlockCache return NoopCache instead of null? It is used
in TabletServerResourceManager as well so maybe not.
---
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.
---