hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-15385 PREFETCH_BLOCKS_ON_OPEN in HColumnDescriptor is ignored
Date Wed, 20 Apr 2016 16:41:34 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 1aa07404a -> a331a57ef


HBASE-15385 PREFETCH_BLOCKS_ON_OPEN in HColumnDescriptor is ignored


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

Branch: refs/heads/branch-1
Commit: a331a57ef82b97995e50f917b678063aea941e22
Parents: 1aa0740
Author: stack <stack@apache.org>
Authored: Wed Apr 20 09:41:28 2016 -0700
Committer: stack <stack@apache.org>
Committed: Wed Apr 20 09:41:28 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/hfile/CacheConfig.java  |  7 +++++--
 .../apache/hadoop/hbase/io/hfile/HFileReaderV2.java    |  6 +++---
 .../org/apache/hadoop/hbase/io/hfile/TestPrefetch.java | 13 +++++++++++++
 3 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a331a57e/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
index 2b76b88..e79ba35 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java
@@ -232,11 +232,14 @@ public class CacheConfig {
             HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1) || family.isCacheDataInL1(),
         conf.getBoolean(DROP_BEHIND_CACHE_COMPACTION_KEY,DROP_BEHIND_CACHE_COMPACTION_DEFAULT)
      );
+    LOG.info("Created cacheConfig for " + family.getNameAsString() + ": " + this);
   }
 
   /**
    * Create a cache configuration using the specified configuration object and
-   * defaults for family level settings.
+   * defaults for family level settings. Only use if no column family context. Prefer
+   * {@link CacheConfig#CacheConfig(Configuration, HColumnDescriptor)}
+   * @see #CacheConfig(Configuration, HColumnDescriptor)
    * @param conf hbase configuration
    */
   public CacheConfig(Configuration conf) {
@@ -254,6 +257,7 @@ public class CacheConfig {
           HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1),
         conf.getBoolean(DROP_BEHIND_CACHE_COMPACTION_KEY,DROP_BEHIND_CACHE_COMPACTION_DEFAULT)
      );
+    LOG.info("Created cacheConfig: " + this);
   }
 
   /**
@@ -289,7 +293,6 @@ public class CacheConfig {
     this.prefetchOnOpen = prefetchOnOpen;
     this.cacheDataInL1 = cacheDataInL1;
     this.dropBehindCompaction = dropBehindCompaction;
-    LOG.info(this);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/a331a57e/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
index ba09bc1..5979632 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
@@ -195,7 +195,7 @@ public class HFileReaderV2 extends AbstractHFileReader {
             end = getTrailer().getLoadOnOpenDataOffset();
             HFileBlock prevBlock = null;
             if (LOG.isTraceEnabled()) {
-              LOG.trace("File=" + path.toString() + ", offset=" + offset + ", end=" + end);
+              LOG.trace("Prefetch=" + path.toString() + ", offset=" + offset + ", end=" +
end);
             }
             while (offset < end) {
               if (Thread.interrupted()) {
@@ -213,11 +213,11 @@ public class HFileReaderV2 extends AbstractHFileReader {
           } catch (IOException e) {
             // IOExceptions are probably due to region closes (relocation, etc.)
             if (LOG.isTraceEnabled()) {
-              LOG.trace("File=" + path.toString() + ", offset=" + offset + ", end=" + end,
e);
+              LOG.trace("Prefetch=" + path.toString() + ", offset=" + offset + ", end=" +
end, e);
             }
           } catch (Exception e) {
             // Other exceptions are interesting
-            LOG.warn("File=" + path.toString() + ", offset=" + offset + ", end=" + end, e);
+            LOG.warn("Prefetch=" + path.toString() + ", offset=" + offset + ", end=" + end,
e);
           } finally {
             PrefetchExecutor.complete(path);
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a331a57e/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java
index 1bcc4a5..7d3f096 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java
@@ -26,6 +26,9 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.fs.HFileSystem;
@@ -59,6 +62,16 @@ public class TestPrefetch {
     cacheConf = new CacheConfig(conf);
   }
 
+  @Test
+  public void testPrefetchSetInHCDWorks() {
+    HColumnDescriptor hcd = new HColumnDescriptor(Bytes.toBytes("f"));
+    hcd.setPrefetchBlocksOnOpen(true);
+    Configuration c = HBaseConfiguration.create();
+    assertFalse(c.getBoolean(CacheConfig.PREFETCH_BLOCKS_ON_OPEN_KEY, false));
+    CacheConfig cc = new CacheConfig(c, hcd);
+    assertTrue(cc.shouldPrefetchOnOpen());
+  }
+
   @Test(timeout=60000)
   public void testPrefetch() throws Exception {
     Path storeFile = writeStoreFile();


Mime
View raw message