infraio commented on a change in pull request #335: HBASE-22624 Should sanity 
check table configuration when clone snapsh…
URL: https://github.com/apache/hbase/pull/335#discussion_r298511931
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
 ##########
 @@ -0,0 +1,300 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.util;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.CompoundConfiguration;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.DefaultStoreEngine;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
+import org.apache.hadoop.hbase.regionserver.RegionSplitPolicy;
+import 
org.apache.hadoop.hbase.regionserver.compactions.ExploringCompactionPolicy;
+import org.apache.hadoop.hbase.regionserver.compactions.FIFOCompactionPolicy;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Used for master to sanity check {@link 
org.apache.hadoop.hbase.client.TableDescriptor}.
+ */
[email protected]
+public class TableDescriptorChecker {
+  private static Logger LOG = 
LoggerFactory.getLogger(TableDescriptorChecker.class);
+
+  public static final String TABLE_SANITY_CHECKS = "hbase.table.sanity.checks";
+  public static final boolean DEFAULT_TABLE_SANITY_CHECKS = true;
+
+  /**
+   * Checks whether the table conforms to some sane limits, and configured
+   * values (compression, etc) work. Throws an exception if something is wrong.
+   */
+  public static void sanityCheck(final Configuration conf, final 
TableDescriptor td)
+      throws IOException {
+    sanityCheck(conf, td,
+        conf.getBoolean(HMaster.MASTER_CHECK_COMPRESSION, 
HMaster.DEFAULT_MASTER_CHECK_COMPRESSION),
+        conf.getBoolean(HMaster.MASTER_CHECK_ENCRYPTION, 
HMaster.DEFAULT_MASTER_CHECK_ENCRYPTION));
+  }
+
+  /**
+   * Checks whether the table conforms to some sane limits, and configured
+   * values (compression, etc) work. Throws an exception if something is wrong.
+   */
+  public static void sanityCheck(final Configuration conf, final 
TableDescriptor td,
+      boolean checkCompression, boolean checkEncryption) throws IOException {
+    boolean logWarn = false;
 
 Review comment:
   OK.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to