Repository: hbase
Updated Branches:
  refs/heads/branch-1 69b96a666 -> d2fb7e614


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

Branch: refs/heads/branch-1
Commit: d2fb7e61459ea7bf068631822cb670401db15554
Parents: 69b96a6
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 11:10:28 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/d2fb7e61/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