Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 e2d5689e3 -> 0e52565d6


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/0e52565d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0e52565d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0e52565d

Branch: refs/heads/branch-1.2
Commit: 0e52565d640b1fe3057722a3b0d9b8431c4564bb
Parents: e2d5689
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:36:03 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/0e52565d/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 ba75542..87da90b 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
@@ -64,7 +64,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();
@@ -75,18 +77,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