HBASE-14984 Allow memcached block cache to set optimze to false

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

Branch: refs/heads/hbase-12439
Commit: 7099ab4c56518024a26f5c499a9a1f2ea6bacd6e
Parents: d238c17
Author: Elliott Clark <ecl...@apache.org>
Authored: Tue Dec 15 13:24:32 2015 -0800
Committer: Elliott Clark <ecl...@apache.org>
Committed: Wed Dec 16 10:35:42 2015 -0800

----------------------------------------------------------------------
 .../apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7099ab4c/hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java
----------------------------------------------------------------------
diff --git 
a/hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java
 
b/hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java
index f820193..536872e 100644
--- 
a/hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java
+++ 
b/hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java
@@ -68,7 +68,9 @@ public class MemcachedBlockCache implements BlockCache {
   public static final String MEMCACHED_CONFIG_KEY = 
"hbase.cache.memcached.servers";
   public static final String MEMCACHED_TIMEOUT_KEY = 
"hbase.cache.memcached.timeout";
   public static final String MEMCACHED_OPTIMEOUT_KEY = 
"hbase.cache.memcached.optimeout";
+  public static final String MEMCACHED_OPTIMIZE_KEY = 
"hbase.cache.memcached.spy.optimze";
   public static final long MEMCACHED_DEFAULT_TIMEOUT = 500;
+  public static final boolean MEMCACHED_OPTIMIZE_DEFAULT = false;
 
   private final MemcachedClient client;
   private final HFileBlockTranscoder tc = new HFileBlockTranscoder();
@@ -79,18 +81,16 @@ public class MemcachedBlockCache implements BlockCache {
 
     long opTimeout = c.getLong(MEMCACHED_OPTIMEOUT_KEY, 
MEMCACHED_DEFAULT_TIMEOUT);
     long queueTimeout = c.getLong(MEMCACHED_TIMEOUT_KEY, opTimeout + 
MEMCACHED_DEFAULT_TIMEOUT);
+    boolean optimize = c.getBoolean(MEMCACHED_OPTIMIZE_KEY, 
MEMCACHED_OPTIMIZE_DEFAULT);
 
     ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder()
         .setOpTimeout(opTimeout)
         .setOpQueueMaxBlockTime(queueTimeout) // Cap the max time before 
anything times out
         .setFailureMode(FailureMode.Redistribute)
-        .setShouldOptimize(true)              // When regions move lots of 
reads happen together
-                                              // So combining them into single 
requests is nice.
+        .setShouldOptimize(optimize)
         .setDaemon(true)                      // Don't keep threads around 
past the end of days.
         .setUseNagleAlgorithm(false)          // Ain't nobody got time for that
-        .setReadBufferSize(HConstants.DEFAULT_BLOCKSIZE * 4 * 1024);  // 4 
times larger than the
-                                                                      // 
default block just in case
-
+        .setReadBufferSize(HConstants.DEFAULT_BLOCKSIZE * 4 * 1024); // Much 
larger just in case
 
     // Assume only the localhost is serving memecached.
     // A la mcrouter or co-locating memcached with split regionservers.

Reply via email to