accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlmar...@apache.org
Subject accumulo git commit: ACCUMULO-4463: more cleanup
Date Tue, 09 May 2017 21:56:23 GMT
Repository: accumulo
Updated Branches:
  refs/heads/ACCUMULO-4463 b3db4be6a -> cc5739453


ACCUMULO-4463: more cleanup


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cc573945
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cc573945
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cc573945

Branch: refs/heads/ACCUMULO-4463
Commit: cc5739453363665919640058da0943ff9b17f3b0
Parents: b3db4be
Author: Dave Marion <dlmarion@apache.org>
Authored: Tue May 9 17:56:06 2017 -0400
Committer: Dave Marion <dlmarion@apache.org>
Committed: Tue May 9 17:56:06 2017 -0400

----------------------------------------------------------------------
 .../core/client/rfile/RFileScanner.java         |  36 +++---
 .../org/apache/accumulo/core/conf/Property.java |   2 +-
 .../cache/BlockCacheConfiguration.java          |  36 +++---
 .../cache/BlockCacheConfigurationHelper.java    |  18 ++-
 .../file/blockfile/cache/BlockCacheFactory.java | 121 -------------------
 .../file/blockfile/cache/BlockCacheManager.java | 101 ++++++++++++++++
 .../core/file/blockfile/cache/CacheType.java    |  46 +------
 .../cache/lru/LruBlockCacheConfiguration.java   |   5 +-
 .../cache/lru/LruBlockCacheFactory.java         |  22 ++--
 .../tinylfu/TinyLfuBlockCacheConfiguration.java |   5 +-
 .../cache/tinylfu/TinyLfuBlockCacheFactory.java |  18 +--
 .../blockfile/cache/BlockCacheFactoryTest.java  |  24 ++--
 .../file/blockfile/cache/CacheTypeTest.java     |  24 ----
 .../file/blockfile/cache/TestLruBlockCache.java |  76 ++++++------
 .../accumulo/core/file/rfile/RFileTest.java     |  25 ++--
 .../tserver/TabletServerResourceManager.java    |  25 +---
 16 files changed, 228 insertions(+), 356 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
index 808693c..4410d47 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
@@ -36,6 +36,7 @@ import org.apache.accumulo.core.client.rfile.RFileScannerBuilder.InputArgs;
 import org.apache.accumulo.core.client.sample.SamplerConfiguration;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Column;
@@ -43,13 +44,10 @@ import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.blockfile.cache.BlockCache;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfigurationHelper;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
+import org.apache.accumulo.core.file.blockfile.cache.BlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.cache.CacheEntry;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
 import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCache;
-import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheFactory;
 import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
 import org.apache.accumulo.core.file.rfile.RFile;
 import org.apache.accumulo.core.file.rfile.RFile.Reader;
@@ -72,7 +70,7 @@ class RFileScanner extends ScannerOptions implements Scanner {
   private static final Range EMPTY_RANGE = new Range();
 
   private Range range;
-  private BlockCacheFactory<?,?> factory = null;
+  private BlockCacheManager factory = null;
   private BlockCache dataCache = null;
   private BlockCache indexCache = null;
   private Opts opts;
@@ -144,31 +142,25 @@ class RFileScanner extends ScannerOptions implements Scanner {
     this.opts = opts;
 
     if (opts.indexCacheSize > 0 || opts.dataCacheSize > 0) {
-      ConfigurationCopy cc = new ConfigurationCopy();
-      cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
+      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 = BlockCacheFactory.getInstance(cc);
+        factory = BlockCacheManager.getInstance(cc);
       } catch (Exception e) {
         throw new RuntimeException("Error creating BlockCacheFactory", e);
       }
-      BlockCacheConfigurationHelper helper = null;
       if (opts.indexCacheSize > 0) {
-        helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-        helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-        helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(CACHE_BLOCK_SIZE));
-        helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(opts.indexCacheSize));
+        cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(opts.indexCacheSize));
       }
       if (opts.dataCacheSize > 0) {
-        if (null == helper) {
-          helper = new BlockCacheConfigurationHelper(CacheType.DATA, factory);
-        } else {
-          helper.switchCacheType(CacheType.DATA);
-        }
-        helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-        helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(CACHE_BLOCK_SIZE));
-        helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(opts.dataCacheSize));
+        cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(opts.dataCacheSize));
       }
-      factory.start(helper.getConfiguration());
+      factory.start(cc);
       this.indexCache = factory.getBlockCache(CacheType.INDEX);
       if (null == indexCache) {
         this.indexCache = new NoopCache();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/conf/Property.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 23ca6a9..c74ed8c 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -245,7 +245,7 @@ public enum Property {
   TSERV_PREFIX("tserver.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of the tablet servers"),
   TSERV_CLIENT_TIMEOUT("tserver.client.timeout", "3s", PropertyType.TIMEDURATION, "Time to wait for clients to continue scans before closing a session."),
   TSERV_DEFAULT_BLOCKSIZE("tserver.default.blocksize", "1M", PropertyType.BYTES, "Specifies a default blocksize for the tserver caches"),
-  TSERV_CACHE_FACTORY_IMPL("tserver.cache.factory.class", "org.apache.accumulo.core.file.blockfile.cache.lru.LRUBlockCacheFactory.class", PropertyType.STRING,
+  TSERV_CACHE_FACTORY_IMPL("tserver.cache.factory.class", "org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheFactory", PropertyType.STRING,
       "Specifies the class name of the block cache factory implementation."),
   TSERV_DATACACHE_SIZE("tserver.cache.data.size", "10%", PropertyType.MEMORY, "Specifies the size of the cache for file data blocks."),
   TSERV_INDEXCACHE_SIZE("tserver.cache.index.size", "25%", PropertyType.MEMORY, "Specifies the size of the cache for file indices."),

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfiguration.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfiguration.java
index 68d536d..bfcfbdf 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfiguration.java
@@ -24,11 +24,6 @@ import org.apache.accumulo.core.conf.Property;
 
 public class BlockCacheConfiguration {
 
-  public static final String MAX_SIZE_PROPERTY = "max.size";
-  public static final String BLOCK_SIZE_PROPERTY = "block.size";
-
-  private static final Long DEFAULT = Long.valueOf(-1);
-
   /** Maximum allowable size of cache (block put if size > max, evict) */
   private final long maxSize;
 
@@ -37,20 +32,25 @@ public class BlockCacheConfiguration {
 
   protected final BlockCacheConfigurationHelper helper;
 
-  public BlockCacheConfiguration(AccumuloConfiguration conf, CacheType type, BlockCacheFactory<?,?> factory) {
-
-    helper = new BlockCacheConfigurationHelper(conf, type, factory);
-
-    Map<String,String> props = conf.getAllPropertiesWithPrefix(Property.GENERAL_ARBITRARY_PROP_PREFIX);
-    this.maxSize = getOrDefault(props, helper.getFullPropertyName(MAX_SIZE_PROPERTY), DEFAULT);
-    this.blockSize = getOrDefault(props, helper.getFullPropertyName(BLOCK_SIZE_PROPERTY), DEFAULT);
-
-    if (DEFAULT.equals(this.maxSize)) {
-      throw new IllegalArgumentException("Block cache max size must be specified.");
-    }
-    if (DEFAULT.equals(this.blockSize)) {
-      throw new IllegalArgumentException("Block cache block size must be specified.");
+  public BlockCacheConfiguration(AccumuloConfiguration conf, CacheType type, String implName) {
+
+    helper = new BlockCacheConfigurationHelper(conf, type, implName);
+
+    switch (type) {
+      case INDEX:
+        this.maxSize = conf.getAsBytes(Property.TSERV_INDEXCACHE_SIZE);
+        break;
+      case DATA:
+        this.maxSize = conf.getAsBytes(Property.TSERV_DATACACHE_SIZE);
+        break;
+      case SUMMARY:
+        this.maxSize = conf.getAsBytes(Property.TSERV_SUMMARYCACHE_SIZE);
+        break;
+      default:
+        this.maxSize = conf.getAsBytes(Property.TSERV_DEFAULT_BLOCKSIZE);
+        break;
     }
+    this.blockSize = conf.getAsBytes(Property.TSERV_DEFAULT_BLOCKSIZE);
   }
 
   public long getMaxSize() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfigurationHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfigurationHelper.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfigurationHelper.java
index bef039e..867114d 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfigurationHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheConfigurationHelper.java
@@ -22,25 +22,21 @@ import org.apache.accumulo.core.conf.ConfigurationCopy;
 public class BlockCacheConfigurationHelper {
 
   private final ConfigurationCopy conf;
-  private final BlockCacheFactory<?,?> factory;
+  private final String implName;
   private String basePropertyName;
 
-  public BlockCacheConfigurationHelper(CacheType type, BlockCacheFactory<?,?> factory) {
-    this(new ConfigurationCopy(), type, factory);
+  public BlockCacheConfigurationHelper(AccumuloConfiguration conf, CacheType type, String implName) {
+    this(new ConfigurationCopy(conf), type, implName);
   }
 
-  public BlockCacheConfigurationHelper(AccumuloConfiguration conf, CacheType type, BlockCacheFactory<?,?> factory) {
-    this(new ConfigurationCopy(conf), type, factory);
-  }
-
-  public BlockCacheConfigurationHelper(ConfigurationCopy conf, CacheType type, BlockCacheFactory<?,?> factory) {
+  public BlockCacheConfigurationHelper(ConfigurationCopy conf, CacheType type, String implName) {
     this.conf = conf;
-    this.factory = factory;
-    this.basePropertyName = type.getPropertyPrefix(factory.getCacheImplName());
+    this.implName = implName;
+    this.basePropertyName = type.getPropertyPrefix(implName);
   }
 
   public void switchCacheType(CacheType type) {
-    this.basePropertyName = type.getPropertyPrefix(factory.getCacheImplName());
+    this.basePropertyName = type.getPropertyPrefix(implName);
   }
 
   public String getFullPropertyName(String propertySuffix) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactory.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactory.java
deleted file mode 100644
index 9fdfa5e..0000000
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactory.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.core.file.blockfile.cache;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.ConfigurationCopy;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class BlockCacheFactory<B extends BlockCache,C extends BlockCacheConfiguration> {
-
-  public static final String CACHE_PROPERTY_BASE = Property.GENERAL_ARBITRARY_PROP_PREFIX + "cache.block.";
-
-  private static final Logger LOG = LoggerFactory.getLogger(BlockCacheFactory.class);
-  private static BlockCacheFactory<?,?> factory = null;
-
-  private final Map<CacheType,B> caches = new HashMap<>();
-
-  /**
-   * Initialize the caches for each CacheType based on the configuration
-   * 
-   * @param conf
-   *          accumulo configuration
-   */
-  public void start(AccumuloConfiguration conf) {
-    for (CacheType type : CacheType.values()) {
-      ConfigurationCopy props = type.getCacheProperties(conf, getCacheImplName());
-      if (null != props) {
-        C cc = this.createConfiguration(props, type, this);
-        B cache = this.createCache(cc);
-        LOG.info("Created {} cache with configuration {}", type, cc);
-        this.caches.put(type, cache);
-      }
-    }
-  }
-
-  /**
-   * Stop caches and release resources
-   */
-  public abstract void stop();
-
-  /**
-   * Get the block cache of the given type
-   * 
-   * @param type
-   *          block cache type
-   * @return BlockCache or null if not enabled
-   */
-  public B getBlockCache(CacheType type) {
-    return caches.get(type);
-  }
-
-  /**
-   * Parse and validate the configuration
-   * 
-   * @param conf
-   *          accumulo configuration
-   * @param type
-   *          cache type
-   * @param name
-   *          cache implementation name
-   * @return validated block cache configuration
-   */
-  protected abstract C createConfiguration(AccumuloConfiguration conf, CacheType type, BlockCacheFactory<B,C> factory);
-
-  /**
-   * Create a block cache using the supplied configuration
-   * 
-   * @param conf
-   *          cache configuration
-   * @return configured block cache
-   */
-  protected abstract B createCache(C conf);
-
-  /**
-   * Cache implementation name (e.g lru, tinylfu, etc)
-   * 
-   * @return name of cache implementation in lowercase
-   */
-  public abstract String getCacheImplName();
-
-  /**
-   * Get the BlockCacheFactory specified by the property 'tserver.cache.factory.class'
-   * 
-   * @param conf
-   *          accumulo configuration
-   * @return BlockCacheFactory instance
-   * @throws Exception
-   */
-  public static synchronized BlockCacheFactory<?,?> getInstance(AccumuloConfiguration conf) throws Exception {
-    if (null == factory) {
-      String impl = conf.get(Property.TSERV_CACHE_FACTORY_IMPL);
-      @SuppressWarnings("rawtypes")
-      Class<? extends BlockCacheFactory> clazz = AccumuloVFSClassLoader.loadClass(impl, BlockCacheFactory.class);
-      factory = (BlockCacheFactory<?,?>) clazz.newInstance();
-      LOG.info("Created new block cache factory of type: {}", clazz.getSimpleName());
-    }
-    return factory;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManager.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManager.java
new file mode 100644
index 0000000..a3a9b32
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManager.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.file.blockfile.cache;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class BlockCacheManager {
+
+  public static final String CACHE_PROPERTY_BASE = Property.GENERAL_ARBITRARY_PROP_PREFIX + "cache.block.";
+
+  private static final Logger LOG = LoggerFactory.getLogger(BlockCacheManager.class);
+  private static BlockCacheManager factory = null;
+
+  private final Map<CacheType,BlockCache> caches = new HashMap<>();
+
+  /**
+   * Initialize the caches for each CacheType based on the configuration
+   * 
+   * @param conf
+   *          accumulo configuration
+   */
+  public void start(AccumuloConfiguration conf) {
+    for (CacheType type : CacheType.values()) {
+      BlockCache cache = this.createCache(conf, type);
+      this.caches.put(type, cache);
+    }
+  }
+
+  /**
+   * Stop caches and release resources
+   */
+  public void stop() {}
+
+  /**
+   * Get the block cache of the given type
+   * 
+   * @param type
+   *          block cache type
+   * @return BlockCache or null if not enabled
+   */
+  public BlockCache getBlockCache(CacheType type) {
+    return caches.get(type);
+  }
+
+  /**
+   * Create a block cache using the supplied configuration
+   * 
+   * @param conf
+   *          cache configuration
+   * @return configured block cache
+   */
+  protected abstract BlockCache createCache(AccumuloConfiguration conf, CacheType type);
+
+  /**
+   * Cache implementation name (e.g lru, tinylfu, etc)
+   * 
+   * @return name of cache implementation in lowercase
+   */
+  public abstract String getCacheImplName();
+
+  /**
+   * Get the BlockCacheFactory specified by the property 'tserver.cache.factory.class'
+   * 
+   * @param conf
+   *          accumulo configuration
+   * @return BlockCacheFactory instance
+   * @throws Exception
+   */
+  public static synchronized BlockCacheManager getInstance(AccumuloConfiguration conf) throws Exception {
+    if (null == factory) {
+      String impl = conf.get(Property.TSERV_CACHE_FACTORY_IMPL);
+      Class<? extends BlockCacheManager> clazz = AccumuloVFSClassLoader.loadClass(impl, BlockCacheManager.class);
+      factory = (BlockCacheManager) clazz.newInstance();
+      LOG.info("Created new block cache factory of type: {}", clazz.getSimpleName());
+    }
+    return factory;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/CacheType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/CacheType.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/CacheType.java
index 7a716fd..f65ac34 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/CacheType.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/CacheType.java
@@ -17,56 +17,12 @@
  */
 package org.apache.accumulo.core.file.blockfile.cache;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.ConfigurationCopy;
-import org.apache.accumulo.core.conf.Property;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 public enum CacheType {
 
   DATA, INDEX, SUMMARY;
 
-  public static final String ENABLED_SUFFIX = "enabled";
-
-  private static final Logger LOG = LoggerFactory.getLogger(CacheType.class);
-
   public String getPropertyPrefix(String impl) {
-    return BlockCacheFactory.CACHE_PROPERTY_BASE + impl + "." + name().toLowerCase() + ".";
-  }
-
-  /**
-   * Return configuration properties for this cache type, if enabled
-   * 
-   * @param conf
-   *          accumulo configuration object
-   * @param type
-   *          type of cache
-   * @param typePrefix
-   *          property prefix for this cache type
-   * @return configuration for this type of cache, or null
-   */
-  public ConfigurationCopy getCacheProperties(AccumuloConfiguration conf, String implName) {
-    Map<String,String> props = conf.getAllPropertiesWithPrefix(Property.GENERAL_ARBITRARY_PROP_PREFIX);
-    String prefix = getPropertyPrefix(implName);
-    String enabled = props.get(prefix + ENABLED_SUFFIX);
-    if (enabled != null && Boolean.parseBoolean(enabled)) {
-      LOG.info("{} cache is enabled.", this);
-      Map<String,String> results = new HashMap<>();
-      for (Entry<String,String> prop : props.entrySet()) {
-        if (prop.getKey().startsWith(prefix)) {
-          results.put(prop.getKey(), prop.getValue());
-        }
-      }
-      return new ConfigurationCopy(results);
-    } else {
-      LOG.info("{} cache is disabled.", this);
-      return null;
-    }
+    return BlockCacheManager.CACHE_PROPERTY_BASE + impl + "." + name().toLowerCase() + ".";
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
index 32fac8a..ba8a125 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
@@ -22,7 +22,6 @@ import java.util.Map;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
 
 public final class LruBlockCacheConfiguration extends BlockCacheConfiguration {
@@ -75,8 +74,8 @@ public final class LruBlockCacheConfiguration extends BlockCacheConfiguration {
 
   private final boolean useEvictionThread;
 
-  public LruBlockCacheConfiguration(AccumuloConfiguration conf, CacheType type, BlockCacheFactory<LruBlockCache,LruBlockCacheConfiguration> factory) {
-    super(conf, type, factory);
+  public LruBlockCacheConfiguration(AccumuloConfiguration conf, CacheType type, String implName) {
+    super(conf, type, implName);
     Map<String,String> props = conf.getAllPropertiesWithPrefix(Property.GENERAL_ARBITRARY_PROP_PREFIX);
     this.acceptableFactor = getOrDefault(props, helper.getFullPropertyName(ACCEPTABLE_FACTOR_PROPERTY), DEFAULT_ACCEPTABLE_FACTOR);
     this.minFactor = getOrDefault(props, helper.getFullPropertyName(MIN_FACTOR_PROPERTY), DEFAULT_MIN_FACTOR);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheFactory.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheFactory.java
index b3318a0..2ce115b 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheFactory.java
@@ -18,20 +18,21 @@
 package org.apache.accumulo.core.file.blockfile.cache.lru;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
+import org.apache.accumulo.core.file.blockfile.cache.BlockCache;
+import org.apache.accumulo.core.file.blockfile.cache.BlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class LruBlockCacheFactory extends BlockCacheFactory<LruBlockCache,LruBlockCacheConfiguration> {
+public class LruBlockCacheFactory extends BlockCacheManager {
 
-  @Override
-  protected LruBlockCacheConfiguration createConfiguration(AccumuloConfiguration conf, CacheType type,
-      BlockCacheFactory<LruBlockCache,LruBlockCacheConfiguration> factory) {
-    return new LruBlockCacheConfiguration(conf, type, factory);
-  }
+  private static final Logger LOG = LoggerFactory.getLogger(LruBlockCacheFactory.class);
 
   @Override
-  protected LruBlockCache createCache(LruBlockCacheConfiguration conf) {
-    return new LruBlockCache(conf);
+  protected BlockCache createCache(AccumuloConfiguration conf, CacheType type) {
+    LruBlockCacheConfiguration cc = new LruBlockCacheConfiguration(conf, type, getCacheImplName());
+    LOG.info("Creating {} cache with configuration {}", type, cc);
+    return new LruBlockCache(cc);
   }
 
   @Override
@@ -39,7 +40,4 @@ public class LruBlockCacheFactory extends BlockCacheFactory<LruBlockCache,LruBlo
     return "lru";
   }
 
-  @Override
-  public void stop() {}
-
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheConfiguration.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheConfiguration.java
index 7b06872..02d7b61 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheConfiguration.java
@@ -19,13 +19,12 @@ package org.apache.accumulo.core.file.blockfile.cache.tinylfu;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
 
 public final class TinyLfuBlockCacheConfiguration extends BlockCacheConfiguration {
 
-  public TinyLfuBlockCacheConfiguration(AccumuloConfiguration conf, CacheType type, BlockCacheFactory<TinyLfuBlockCache,TinyLfuBlockCacheConfiguration> factory) {
-    super(conf, type, factory);
+  public TinyLfuBlockCacheConfiguration(AccumuloConfiguration conf, CacheType type, String implName) {
+    super(conf, type, implName);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheFactory.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheFactory.java
index f45d7a7..f3ca95c 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCacheFactory.java
@@ -18,20 +18,20 @@
 package org.apache.accumulo.core.file.blockfile.cache.tinylfu;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
+import org.apache.accumulo.core.file.blockfile.cache.BlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class TinyLfuBlockCacheFactory extends BlockCacheFactory<TinyLfuBlockCache,TinyLfuBlockCacheConfiguration> {
+public class TinyLfuBlockCacheFactory extends BlockCacheManager {
 
-  @Override
-  protected TinyLfuBlockCacheConfiguration createConfiguration(AccumuloConfiguration conf, CacheType type,
-      BlockCacheFactory<TinyLfuBlockCache,TinyLfuBlockCacheConfiguration> factory) {
-    return new TinyLfuBlockCacheConfiguration(conf, type, factory);
-  }
+  private static final Logger LOG = LoggerFactory.getLogger(TinyLfuBlockCacheFactory.class);
 
   @Override
-  protected TinyLfuBlockCache createCache(TinyLfuBlockCacheConfiguration conf) {
-    return new TinyLfuBlockCache(conf);
+  protected TinyLfuBlockCache createCache(AccumuloConfiguration conf, CacheType type) {
+    TinyLfuBlockCacheConfiguration cc = new TinyLfuBlockCacheConfiguration(conf, type, getCacheImplName());
+    LOG.info("Creating {} cache with configuration {}", type, cc);
+    return new TinyLfuBlockCache(cc);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
index beef072..39539c5 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
@@ -18,6 +18,7 @@
 package org.apache.accumulo.core.file.blockfile.cache;
 
 import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheFactory;
 import org.apache.accumulo.core.file.blockfile.cache.tinylfu.TinyLfuBlockCacheFactory;
@@ -28,28 +29,25 @@ public class BlockCacheFactoryTest {
 
   @Test
   public void testCreateLruBlockCacheFactory() throws Exception {
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory.getInstance(cc);
+    BlockCacheManager.getInstance(cc);
   }
 
   @Test
   public void testCreateTinyLfuBlockCacheFactory() throws Exception {
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, TinyLfuBlockCacheFactory.class.getName());
-    BlockCacheFactory.getInstance(cc);
+    BlockCacheManager.getInstance(cc);
   }
 
   @Test
-  public void testStart() throws Exception {
-    ConfigurationCopy cc = new ConfigurationCopy();
-    cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    String indexPrefix = CacheType.INDEX.getPropertyPrefix(factory.getCacheImplName());
-    cc.setIfAbsent(indexPrefix + CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    cc.setIfAbsent(indexPrefix + BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(2048));
-    cc.setIfAbsent(indexPrefix + BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(1048576));
-    factory.start(cc);
+  public void testStartWithDefault() throws Exception {
+    DefaultConfiguration dc = new DefaultConfiguration();
+    BlockCacheManager factory = BlockCacheManager.getInstance(dc);
+    factory.start(dc);
     Assert.assertNotNull(factory.getBlockCache(CacheType.INDEX));
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/CacheTypeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/CacheTypeTest.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/CacheTypeTest.java
index 9b0c2da..d7cb586 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/CacheTypeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/CacheTypeTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.accumulo.core.file.blockfile.cache;
 
-import org.apache.accumulo.core.conf.ConfigurationCopy;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -28,27 +27,4 @@ public class CacheTypeTest {
     Assert.assertEquals("general.custom.cache.block.lru.data.", CacheType.DATA.getPropertyPrefix("lru"));
   }
 
-  @Test
-  public void testCacheEnabled() {
-    ConfigurationCopy cc = new ConfigurationCopy();
-    String indexPrefix = CacheType.INDEX.getPropertyPrefix("lru");
-    cc.setIfAbsent(indexPrefix + CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    cc.setIfAbsent(indexPrefix + BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(100000));
-    cc.setIfAbsent(indexPrefix + BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(100000000));
-    ConfigurationCopy cc2 = CacheType.INDEX.getCacheProperties(cc, "lru");
-    Assert.assertNotNull(cc2);
-    Assert.assertEquals(Boolean.TRUE.toString(), cc2.get(indexPrefix + CacheType.ENABLED_SUFFIX));
-    Assert.assertEquals(Long.toString(100000), cc2.get(indexPrefix + BlockCacheConfiguration.BLOCK_SIZE_PROPERTY));
-    Assert.assertEquals(Long.toString(100000000), cc2.get(indexPrefix + BlockCacheConfiguration.MAX_SIZE_PROPERTY));
-  }
-
-  @Test
-  public void testCacheDisabled() {
-    ConfigurationCopy cc = new ConfigurationCopy();
-    String indexPrefix = CacheType.INDEX.getPropertyPrefix("lru");
-    cc.setIfAbsent(indexPrefix + CacheType.ENABLED_SUFFIX, Boolean.FALSE.toString());
-    ConfigurationCopy cc2 = CacheType.INDEX.getCacheProperties(cc, "lru");
-    Assert.assertNull(cc2);
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
index 2dc244b..4bf0eba 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
@@ -23,6 +23,7 @@ import java.util.Random;
 import junit.framework.TestCase;
 
 import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCache;
 import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheConfiguration;
@@ -42,14 +43,13 @@ public class TestLruBlockCache extends TestCase {
     long maxSize = 100000;
     long blockSize = calculateBlockSizeDefault(maxSize, 9); // room for 9, will evict
 
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-    helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(maxSize));
-    factory.start(helper.getConfiguration());
+    BlockCacheManager factory = BlockCacheManager.getInstance(cc);
+    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(blockSize));
+    cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(maxSize));
+    factory.start(cc);
     LruBlockCache cache = (LruBlockCache) factory.getBlockCache(CacheType.INDEX);
 
     Block[] blocks = generateFixedBlocks(10, blockSize, "block");
@@ -74,14 +74,13 @@ public class TestLruBlockCache extends TestCase {
     long maxSize = 1000000;
     long blockSize = calculateBlockSizeDefault(maxSize, 101);
 
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-    helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(maxSize));
-    factory.start(helper.getConfiguration());
+    BlockCacheManager factory = BlockCacheManager.getInstance(cc);
+    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(blockSize));
+    cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(maxSize));
+    factory.start(cc);
     LruBlockCache cache = (LruBlockCache) factory.getBlockCache(CacheType.INDEX);
 
     Block[] blocks = generateRandomBlocks(100, blockSize);
@@ -131,13 +130,13 @@ public class TestLruBlockCache extends TestCase {
     long maxSize = 100000;
     long blockSize = calculateBlockSizeDefault(maxSize, 10);
 
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-    helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(maxSize));
+    BlockCacheManager factory = BlockCacheManager.getInstance(cc);
+    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(blockSize));
+    cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(maxSize));
+    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory.getCacheImplName());
     helper.set(LruBlockCacheConfiguration.EVICTION_THREAD_PROPERTY, Boolean.FALSE.toString());
     factory.start(helper.getConfiguration());
     LruBlockCache cache = (LruBlockCache) factory.getBlockCache(CacheType.INDEX);
@@ -177,13 +176,13 @@ public class TestLruBlockCache extends TestCase {
     long maxSize = 100000;
     long blockSize = calculateBlockSizeDefault(maxSize, 10);
 
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-    helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(maxSize));
+    BlockCacheManager factory = BlockCacheManager.getInstance(cc);
+    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(blockSize));
+    cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(maxSize));
+    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory.getCacheImplName());
     helper.set(LruBlockCacheConfiguration.EVICTION_THREAD_PROPERTY, Boolean.FALSE.toString());
     helper.set(LruBlockCacheConfiguration.MIN_FACTOR_PROPERTY, Float.toString(0.98f));
     helper.set(LruBlockCacheConfiguration.ACCEPTABLE_FACTOR_PROPERTY, Float.toString(0.99f));
@@ -245,13 +244,13 @@ public class TestLruBlockCache extends TestCase {
     long maxSize = 100000;
     long blockSize = calculateBlockSize(maxSize, 10);
 
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-    helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(maxSize));
+    BlockCacheManager factory = BlockCacheManager.getInstance(cc);
+    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(blockSize));
+    cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(maxSize));
+    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory.getCacheImplName());
     helper.set(LruBlockCacheConfiguration.EVICTION_THREAD_PROPERTY, Boolean.FALSE.toString());
     helper.set(LruBlockCacheConfiguration.MIN_FACTOR_PROPERTY, Float.toString(0.98f));
     helper.set(LruBlockCacheConfiguration.ACCEPTABLE_FACTOR_PROPERTY, Float.toString(0.99f));
@@ -372,13 +371,14 @@ public class TestLruBlockCache extends TestCase {
     long maxSize = 100000;
     long blockSize = calculateBlockSize(maxSize, 10);
 
-    ConfigurationCopy cc = new ConfigurationCopy();
+    DefaultConfiguration dc = new DefaultConfiguration();
+    ConfigurationCopy cc = new ConfigurationCopy(dc);
     cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-    BlockCacheFactory<?,?> factory = BlockCacheFactory.getInstance(cc);
-    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-    helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(maxSize));
+    BlockCacheManager factory = BlockCacheManager.getInstance(cc);
+    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(blockSize));
+    cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(maxSize));
+    BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory.getCacheImplName());
+    helper.set(LruBlockCacheConfiguration.EVICTION_THREAD_PROPERTY, Boolean.FALSE.toString());
     helper.set(LruBlockCacheConfiguration.EVICTION_THREAD_PROPERTY, Boolean.FALSE.toString());
     helper.set(LruBlockCacheConfiguration.MIN_FACTOR_PROPERTY, Float.toString(0.66f));
     helper.set(LruBlockCacheConfiguration.ACCEPTABLE_FACTOR_PROPERTY, Float.toString(0.99f));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index 5b04b41..442e62d 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -48,6 +48,7 @@ import org.apache.accumulo.core.client.sample.Sampler;
 import org.apache.accumulo.core.client.sample.SamplerConfiguration;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 import org.apache.accumulo.core.data.ByteSequence;
@@ -57,9 +58,7 @@ import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.data.impl.KeyExtent;
 import org.apache.accumulo.core.file.FileSKVIterator;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfigurationHelper;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
+import org.apache.accumulo.core.file.blockfile.cache.BlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
 import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCache;
 import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheFactory;
@@ -269,23 +268,19 @@ public class RFileTest {
       in = new FSDataInputStream(bais);
       fileLength = data.length;
 
-      ConfigurationCopy cc = new ConfigurationCopy();
+      DefaultConfiguration dc = new DefaultConfiguration();
+      ConfigurationCopy cc = new ConfigurationCopy(dc);
       cc.set(Property.TSERV_CACHE_FACTORY_IMPL, LruBlockCacheFactory.class.getName());
-      BlockCacheFactory<?,?> factory;
+      BlockCacheManager factory;
       try {
-        factory = BlockCacheFactory.getInstance(cc);
+        factory = BlockCacheManager.getInstance(cc);
       } catch (Exception e) {
         throw new RuntimeException("Error creating BlockCacheFactory", e);
       }
-      BlockCacheConfigurationHelper helper = new BlockCacheConfigurationHelper(cc, CacheType.INDEX, factory);
-      helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-      helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(100000));
-      helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(100000000));
-      helper.switchCacheType(CacheType.DATA);
-      helper.set(CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-      helper.set(BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(100000));
-      helper.set(BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(100000000));
-      factory.start(helper.getConfiguration());
+      cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(100000));
+      cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(100000000));
+      cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(100000000));
+      factory.start(cc);
       LruBlockCache indexCache = (LruBlockCache) factory.getBlockCache(CacheType.INDEX);
       LruBlockCache dataCache = (LruBlockCache) factory.getBlockCache(CacheType.DATA);
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc573945/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
index 276e29f..402639f 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
@@ -37,12 +37,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.ConfigurationCopy;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.impl.KeyExtent;
 import org.apache.accumulo.core.file.blockfile.cache.BlockCache;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheConfiguration;
-import org.apache.accumulo.core.file.blockfile.cache.BlockCacheFactory;
+import org.apache.accumulo.core.file.blockfile.cache.BlockCacheManager;
 import org.apache.accumulo.core.file.blockfile.cache.CacheType;
 import org.apache.accumulo.core.metadata.schema.DataFileValue;
 import org.apache.accumulo.core.util.Daemon;
@@ -101,7 +99,7 @@ public class TabletServerResourceManager {
 
   private final MemoryManagementFramework memMgmt;
 
-  private final BlockCacheFactory<?,?> factory;
+  private final BlockCacheManager factory;
   private final BlockCache _dCache;
   private final BlockCache _iCache;
   private final BlockCache _sCache;
@@ -172,33 +170,18 @@ public class TabletServerResourceManager {
     long maxMemory = acuConf.getAsBytes(Property.TSERV_MAXMEM);
     boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) && NativeMap.isLoaded();
 
-    long blockSize = acuConf.getAsBytes(Property.TSERV_DEFAULT_BLOCKSIZE);
     long dCacheSize = acuConf.getAsBytes(Property.TSERV_DATACACHE_SIZE);
     long iCacheSize = acuConf.getAsBytes(Property.TSERV_INDEXCACHE_SIZE);
     long sCacheSize = acuConf.getAsBytes(Property.TSERV_SUMMARYCACHE_SIZE);
     long totalQueueSize = acuConf.getAsBytes(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX);
 
     try {
-      factory = BlockCacheFactory.getInstance(acuConf);
+      factory = BlockCacheManager.getInstance(acuConf);
     } catch (Exception e) {
       throw new RuntimeException("Error creating BlockCacheFactory", e);
     }
 
-    ConfigurationCopy cc = new ConfigurationCopy(acuConf);
-    String indexPrefix = CacheType.INDEX.getPropertyPrefix(factory.getCacheImplName());
-    cc.setIfAbsent(indexPrefix + CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    cc.setIfAbsent(indexPrefix + BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    cc.setIfAbsent(indexPrefix + BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(iCacheSize));
-    String dataPrefix = CacheType.DATA.getPropertyPrefix(factory.getCacheImplName());
-    cc.setIfAbsent(dataPrefix + CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    cc.setIfAbsent(dataPrefix + BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    cc.setIfAbsent(dataPrefix + BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(dCacheSize));
-    String summaryPrefix = CacheType.DATA.getPropertyPrefix(factory.getCacheImplName());
-    cc.setIfAbsent(summaryPrefix + CacheType.ENABLED_SUFFIX, Boolean.TRUE.toString());
-    cc.setIfAbsent(summaryPrefix + BlockCacheConfiguration.BLOCK_SIZE_PROPERTY, Long.toString(blockSize));
-    cc.setIfAbsent(summaryPrefix + BlockCacheConfiguration.MAX_SIZE_PROPERTY, Long.toString(sCacheSize));
-
-    factory.start(cc);
+    factory.start(acuConf);
 
     _iCache = factory.getBlockCache(CacheType.INDEX);
     _dCache = factory.getBlockCache(CacheType.DATA);


Mime
View raw message