hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject hbase git commit: HBASE-16404 Make DeleteBloomFilters work with BloomContext (Ram)
Date Fri, 12 Aug 2016 09:40:27 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 285e10417 -> 65c03b058


HBASE-16404 Make DeleteBloomFilters work with BloomContext (Ram)


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

Branch: refs/heads/master
Commit: 65c03b058c7b4a74f991acc07958be5e7d0e05e6
Parents: 285e104
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Fri Aug 12 15:09:31 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Fri Aug 12 15:09:31 2016 +0530

----------------------------------------------------------------------
 .../hbase/regionserver/StoreFileWriter.java     | 45 +++++++-------------
 .../apache/hadoop/hbase/util/BloomContext.java  |  9 ++--
 .../hadoop/hbase/util/RowBloomContext.java      |  4 +-
 3 files changed, 23 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/65c03b05/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileWriter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileWriter.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileWriter.java
index 47a8b25..cb5d12c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileWriter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileWriter.java
@@ -58,9 +58,9 @@ public class StoreFileWriter implements Compactor.CellSink {
   private final BloomFilterWriter deleteFamilyBloomFilterWriter;
   private final BloomType bloomType;
   private long earliestPutTs = HConstants.LATEST_TIMESTAMP;
-  private Cell lastDeleteFamilyCell = null;
   private long deleteFamilyCnt = 0;
   private BloomContext bloomContext = null;
+  private BloomContext deleteFamilyBloomContext = null;
 
   /**
    * timeRangeTrackerSet is used to figure if we were passed a filled-out TimeRangeTracker
or not.
@@ -137,6 +137,18 @@ public class StoreFileWriter implements Compactor.CellSink {
         LOG.trace("Bloom filter type for " + path + ": " + this.bloomType + ", " +
             generalBloomFilterWriter.getClass().getSimpleName());
       }
+      // init bloom context
+      switch (bloomType) {
+      case ROW:
+        bloomContext = new RowBloomContext(generalBloomFilterWriter);
+        break;
+      case ROWCOL:
+        bloomContext = new RowColBloomContext(generalBloomFilterWriter);
+        break;
+      default:
+        throw new IOException(
+            "Invalid Bloom filter type: " + bloomType + " (ROW or ROWCOL expected)");
+      }
     } else {
       // Not using Bloom filters.
       this.bloomType = BloomType.NONE;
@@ -148,6 +160,7 @@ public class StoreFileWriter implements Compactor.CellSink {
       this.deleteFamilyBloomFilterWriter = BloomFilterFactory
           .createDeleteBloomAtWrite(conf, cacheConf,
               (int) Math.min(maxKeys, Integer.MAX_VALUE), writer);
+      deleteFamilyBloomContext = new RowBloomContext(deleteFamilyBloomFilterWriter);
     } else {
       deleteFamilyBloomFilterWriter = null;
     }
@@ -213,22 +226,6 @@ public class StoreFileWriter implements Compactor.CellSink {
 
   private void appendGeneralBloomfilter(final Cell cell) throws IOException {
     if (this.generalBloomFilterWriter != null) {
-      // only add to the bloom filter on a new, unique key
-      if (this.bloomContext == null) {
-        // init bloom context
-        switch (bloomType) {
-        case ROW:
-          bloomContext = new RowBloomContext(generalBloomFilterWriter);
-          break;
-        case ROWCOL:
-          bloomContext = new RowColBloomContext(generalBloomFilterWriter);
-          break;
-        default:
-          throw new IOException(
-              "Invalid Bloom filter type: " + bloomType + " (ROW or ROWCOL expected)");
-        }
-      }
-
       /*
        * http://2.bp.blogspot.com/_Cib_A77V54U/StZMrzaKufI/AAAAAAAAADo/ZhK7bGoJdMQ/s400/KeyValue.png
        * Key = RowLen + Row + FamilyLen + Column [Family + Qualifier] + TimeStamp
@@ -249,18 +246,8 @@ public class StoreFileWriter implements Compactor.CellSink {
 
     // increase the number of delete family in the store file
     deleteFamilyCnt++;
-    if (null != this.deleteFamilyBloomFilterWriter) {
-      boolean newKey = true;
-      if (lastDeleteFamilyCell != null) {
-        // hbase:meta does not have blooms. So we need not have special interpretation
-        // of the hbase:meta cells
-        newKey = !CellUtil.matchingRows(cell, lastDeleteFamilyCell);
-      }
-      // TODO : Use bloom context for delete family bloom filter also
-      if (newKey) {
-        this.deleteFamilyBloomFilterWriter.add(cell);
-        this.lastDeleteFamilyCell = cell;
-      }
+    if (this.deleteFamilyBloomFilterWriter != null) {
+      deleteFamilyBloomContext.writeBloom(cell);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/65c03b05/hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomContext.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomContext.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomContext.java
index aab30e0..fc40aaf 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomContext.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomContext.java
@@ -33,10 +33,10 @@ public abstract class BloomContext {
   // TODO : Avoid holding references to lastCell
   protected Cell lastCell;
 
-  protected BloomFilterWriter generalBloomFilterWriter;
+  protected BloomFilterWriter bloomFilterWriter;
 
-  public BloomContext(BloomFilterWriter generalBloomFilterWriter) {
-    this.generalBloomFilterWriter = generalBloomFilterWriter;
+  public BloomContext(BloomFilterWriter bloomFilterWriter) {
+    this.bloomFilterWriter = bloomFilterWriter;
   }
 
   public Cell getLastCell() {
@@ -49,8 +49,9 @@ public abstract class BloomContext {
    * @throws IOException
    */
   public void writeBloom(Cell cell) throws IOException {
+    // only add to the bloom filter on a new, unique key
     if (isNewKey(cell)) {
-      generalBloomFilterWriter.add(cell);
+      bloomFilterWriter.add(cell);
       this.lastCell = cell;
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/65c03b05/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowBloomContext.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowBloomContext.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowBloomContext.java
index c61e840..f6e36d4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowBloomContext.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowBloomContext.java
@@ -31,8 +31,8 @@ import org.apache.hadoop.hbase.regionserver.StoreFile;
 @InterfaceAudience.Private
 public class RowBloomContext extends BloomContext {
 
-  public RowBloomContext(BloomFilterWriter generalBloomFilterWriter) {
-    super(generalBloomFilterWriter);
+  public RowBloomContext(BloomFilterWriter bloomFilterWriter) {
+    super(bloomFilterWriter);
   }
 
   public void addLastBloomKey(Writer writer) throws IOException {


Mime
View raw message