hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject hbase git commit: HBASE-13431 Allow to skip store file range check based on column family while creating reference files in HRegionFileSystem#splitStoreFile(Rajeshbabu)
Date Wed, 29 Apr 2015 03:00:05 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 5f1676715 -> e2f7508af


HBASE-13431 Allow to skip store file range check based on column family while creating reference
files in HRegionFileSystem#splitStoreFile(Rajeshbabu)


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

Branch: refs/heads/master
Commit: e2f7508afda159293e05c0777da345145fb74bd0
Parents: 5f16767
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Wed Apr 29 08:30:03 2015 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Wed Apr 29 08:30:03 2015 +0530

----------------------------------------------------------------------
 .../hbase/regionserver/HRegionFileSystem.java   |  2 +-
 .../hbase/regionserver/RegionSplitPolicy.java   | 11 ++++++++++
 .../TestSplitTransactionOnCluster.java          | 22 +++++++++++++++-----
 3 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e2f7508a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
index a698609..8d842b6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
@@ -579,7 +579,7 @@ public class HRegionFileSystem {
       final byte[] splitRow, final boolean top, RegionSplitPolicy splitPolicy)
           throws IOException {
 
-    if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck()) {
+    if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck(familyName)) {
       // Check whether the split row lies in the range of the store file
       // If it is outside the range, return directly.
       try {

http://git-wip-us.apache.org/repos/asf/hbase/blob/e2f7508a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.java
index 0e28ebb..2ab2c8d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.java
@@ -133,8 +133,19 @@ public abstract class RegionSplitPolicy extends Configured {
    * the split reference even when the split row not lies in the range. This method can be
used
    * to decide, whether to skip the the StoreFile range check or not.
    * @return whether to skip the StoreFile range check or not
+   * @deprecated Use {@link #skipStoreFileRangeCheck(String)}} instead
    */
+  @Deprecated
   protected boolean skipStoreFileRangeCheck() {
     return false;
   }
+
+  /**
+   * See {@link #skipStoreFileRangeCheck()} javadoc.
+   * @param familyName
+   * @return whether to skip the StoreFile range check or not
+   */
+  protected boolean skipStoreFileRangeCheck(String familyName) {
+    return skipStoreFileRangeCheck();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e2f7508a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
index 66f8cbc..86d196e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -82,9 +83,9 @@ import org.apache.hadoop.hbase.master.RegionState;
 import org.apache.hadoop.hbase.master.RegionState.State;
 import org.apache.hadoop.hbase.master.RegionStates;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
 import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionRequest;
 import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse;
-import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
 import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext;
 import org.apache.hadoop.hbase.regionserver.compactions.NoLimitCompactionThroughputController;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
@@ -1049,6 +1050,7 @@ public class TestSplitTransactionOnCluster {
     try {
       HTableDescriptor htd = new HTableDescriptor(tableName);
       htd.addFamily(new HColumnDescriptor("f"));
+      htd.addFamily(new HColumnDescriptor("i_f"));
       htd.setRegionSplitPolicyClassName(CustomSplitPolicy.class.getName());
       admin.createTable(htd);
       List<HRegion> regions = awaitTableRegions(tableName);
@@ -1056,6 +1058,7 @@ public class TestSplitTransactionOnCluster {
       for(int i = 3;i<9;i++) {
         Put p = new Put(Bytes.toBytes("row"+i));
         p.add(Bytes.toBytes("f"), Bytes.toBytes("q"), Bytes.toBytes("value"+i));
+        p.add(Bytes.toBytes("i_f"), Bytes.toBytes("q"), Bytes.toBytes("value"+i));
         region.put(p);
       }
       region.flush(true);
@@ -1063,8 +1066,13 @@ public class TestSplitTransactionOnCluster {
       Collection<StoreFile> storefiles = store.getStorefiles();
       assertEquals(storefiles.size(), 1);
       assertFalse(region.hasReferences());
-      Path referencePath = region.getRegionFileSystem().splitStoreFile(region.getRegionInfo(),
"f",
-        storefiles.iterator().next(), Bytes.toBytes("row1"), false, region.getSplitPolicy());
+      Path referencePath =
+          region.getRegionFileSystem().splitStoreFile(region.getRegionInfo(), "f",
+            storefiles.iterator().next(), Bytes.toBytes("row1"), false, region.getSplitPolicy());
+      assertNull(referencePath);
+      referencePath =
+          region.getRegionFileSystem().splitStoreFile(region.getRegionInfo(), "i_f",
+            storefiles.iterator().next(), Bytes.toBytes("row1"), false, region.getSplitPolicy());
       assertNotNull(referencePath);
     } finally {
       TESTING_UTIL.deleteTable(tableName);
@@ -1379,8 +1387,12 @@ public class TestSplitTransactionOnCluster {
     }
 
     @Override
-    public boolean skipStoreFileRangeCheck() {
-      return true;
+    public boolean skipStoreFileRangeCheck(String familyName) {
+      if(familyName.startsWith("i_")) {
+        return true;
+      } else {
+        return false;
+      }
     }
   }
 }


Mime
View raw message