hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-16419 check REPLICATION_SCOPE's value more stringently (Guangxu Cheng)
Date Wed, 17 Aug 2016 16:02:00 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 8d93b62f0 -> a944a1987


HBASE-16419 check REPLICATION_SCOPE's value more stringently (Guangxu Cheng)


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

Branch: refs/heads/branch-1
Commit: a944a198791859331f9541ee454afe810db69c45
Parents: 8d93b62
Author: tedyu <yuzhihong@gmail.com>
Authored: Wed Aug 17 09:01:54 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Wed Aug 17 09:01:54 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/master/HMaster.java | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a944a198/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 70c8ecb..19bd484 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -131,6 +131,7 @@ import org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager;
 import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
 import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionServerInfo;
+import org.apache.hadoop.hbase.protobuf.generated.WALProtos;
 import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos;
 import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode;
 import org.apache.hadoop.hbase.quotas.MasterQuotaManager;
@@ -1706,11 +1707,7 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
       }
 
       // check replication scope
-      if (hcd.getScope() < 0) {
-        String message = "Replication scope for column family "
-          + hcd.getNameAsString() + "  must be positive.";
-        warnOrThrowExceptionForFailure(logWarn, CONF_KEY, message, null);
-      }
+      checkReplicationScope(hcd);
 
       // check data replication factor, it can be 0(default value) when user has not explicitly
       // set the value, in this case we use default replication factor set in the file system.
@@ -1724,6 +1721,18 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
     }
   }
 
+  private void checkReplicationScope(HColumnDescriptor hcd) throws IOException{
+    // check replication scope
+    WALProtos.ScopeType scop = WALProtos.ScopeType.valueOf(hcd.getScope());
+    if (scop == null) {
+      String message = "Replication scope for column family "
+          + hcd.getNameAsString() + " is " + hcd.getScope() + " which is invalid.";
+
+      LOG.error(message);
+      throw new DoNotRetryIOException(message);
+    }
+  }
+
   private void checkCompactionPolicy(Configuration conf, HTableDescriptor htd)
       throws IOException {
     // FIFO compaction has some requirements
@@ -1957,6 +1966,7 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
     checkInitialized();
     checkCompression(columnDescriptor);
     checkEncryption(conf, columnDescriptor);
+    checkReplicationScope(columnDescriptor);
     if (cpHost != null) {
       if (cpHost.preAddColumn(tableName, columnDescriptor)) {
         return;
@@ -1983,6 +1993,7 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
     checkInitialized();
     checkCompression(descriptor);
     checkEncryption(conf, descriptor);
+    checkReplicationScope(descriptor);
     if (cpHost != null) {
       if (cpHost.preModifyColumn(tableName, descriptor)) {
         return;


Mime
View raw message