Repository: hbase
Updated Branches:
  refs/heads/branch-2 c0740b84e -> 07d20b2d1


HBASE-19521 HBase mob compaction needs to check hfile version

Signed-off-by: tedyu <[email protected]>


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

Branch: refs/heads/branch-2
Commit: 07d20b2d186941e3a0a271d848ef99039128abfe
Parents: c0740b8
Author: QilinCao <[email protected]>
Authored: Fri Dec 15 16:11:25 2017 +0800
Committer: tedyu <[email protected]>
Committed: Mon Dec 18 08:32:51 2017 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/MasterRpcServices.java      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/07d20b2d/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
index 3e2f0ef..6044d02 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
@@ -54,6 +54,7 @@ import 
org.apache.hadoop.hbase.client.replication.ReplicationPeerConfigUtil;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessor;
 import org.apache.hadoop.hbase.errorhandling.ForeignException;
 import org.apache.hadoop.hbase.exceptions.UnknownProtocolException;
+import org.apache.hadoop.hbase.io.hfile.HFile;
 import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils;
 import org.apache.hadoop.hbase.ipc.PriorityFunction;
 import org.apache.hadoop.hbase.ipc.QosPriority;
@@ -1626,6 +1627,7 @@ public class MasterRpcServices extends RSRpcServices
       TableName tableName = RegionInfo.getTable(regionName);
       // if the region is a mob region, do the mob file compaction.
       if (MobUtils.isMobRegionName(tableName, regionName)) {
+        checkHFileFormatVersionForMob();
         return compactMob(request, tableName);
       } else {
         return super.compactRegion(controller, request);
@@ -1635,6 +1637,20 @@ public class MasterRpcServices extends RSRpcServices
     }
   }
 
+  /**
+   * check configured hfile format version before to do compaction
+   * @throws IOException throw IOException
+   */
+  private void checkHFileFormatVersionForMob() throws IOException {
+    if (HFile.getFormatVersion(master.getConfiguration()) < 
HFile.MIN_FORMAT_VERSION_WITH_TAGS) {
+      LOG.error("A minimum HFile version of " + 
HFile.MIN_FORMAT_VERSION_WITH_TAGS
+          + " is required for MOB compaction. Compaction will not run.");
+      throw new IOException("A minimum HFile version of " + 
HFile.MIN_FORMAT_VERSION_WITH_TAGS
+          + " is required for MOB feature. Consider setting " + 
HFile.FORMAT_VERSION_KEY
+          + " accordingly.");
+    }
+  }
+
   @Override
   @QosPriority(priority=HConstants.ADMIN_QOS)
   public GetRegionInfoResponse getRegionInfo(final RpcController controller,

Reply via email to