junegunn commented on code in PR #6799: URL: https://github.com/apache/hbase/pull/6799#discussion_r2085838073
########## hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java: ########## @@ -79,6 +80,14 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td) // Setting logs to warning instead of throwing exception if sanityChecks are disabled boolean logWarn = !shouldSanityCheck(conf); + // Check value types + warnOrThrowExceptionForFailure(logWarn, () -> ConfigKey.validate(conf)); + warnOrThrowExceptionForFailure(logWarn, () -> { + for (ColumnFamilyDescriptor cfd : td.getColumnFamilies()) { + ConfigKey.validate(new CompoundConfiguration().addBytesMap(cfd.getValues())); Review Comment: @guluo2016 I just rebuilt HBase from the tip of `branch-2`. For an invalid table-level configuration, HBase rejected it as expected. ``` hbase:002:0> create 't03', 'info', { CONFIGURATION => { 'hbase.hstore.defaultengine.compactionpolicy.class' => 'com.test.App' }} ERROR: org.apache.hadoop.hbase.DoNotRetryIOException: 'hbase.hstore.defaultengine.compactionpolicy.class' must be a class. Set hbase.table.sanity.checks to false at conf or table descriptor if you want to bypass sanity checks at org.apache.hadoop.hbase.util.TableDescriptorChecker.warnOrThrowExceptionForFailure(TableDescriptorChecker.java:327) at org.apache.hadoop.hbase.util.TableDescriptorChecker.warnOrThrowExceptionForFailure(TableDescriptorChecker.java:344) at org.apache.hadoop.hbase.util.TableDescriptorChecker.sanityCheck(TableDescriptorChecker.java:84) at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:2400) at org.apache.hadoop.hbase.master.MasterRpcServices.createTable(MasterRpcServices.java:712) at org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java) at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:443) at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:124) at org.apache.hadoop.hbase.ipc.RpcHandler.run(RpcHandler.java:105) at org.apache.hadoop.hbase.ipc.RpcHandler.run(RpcHandler.java:85) Caused by: java.lang.IllegalArgumentException: 'hbase.hstore.defaultengine.compactionpolicy.class' must be a class. at org.apache.hadoop.hbase.conf.ConfigKey.lambda$CLASS$8(ConfigKey.java:109) at org.apache.hadoop.hbase.conf.ConfigKey.lambda$validate$9(ConfigKey.java:133) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at org.apache.hadoop.hbase.conf.ConfigKey.validate(ConfigKey.java:130) at org.apache.hadoop.hbase.util.TableDescriptorChecker.lambda$sanityCheck$0(TableDescriptorChecker.java:84) at org.apache.hadoop.hbase.util.TableDescriptorChecker.warnOrThrowExceptionForFailure(TableDescriptorChecker.java:342) ... 8 more Caused by: java.lang.ClassNotFoundException: com.test.App at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:375) at org.apache.hadoop.hbase.conf.ConfigKey.lambda$CLASS$8(ConfigKey.java:104) ... 13 more For usage try 'help "create"' Took 0.0050 seconds ``` However, as you mentioned, column-family level configuration is not verified unlike in master branch. ``` create 't03', { NAME => 'info', CONFIGURATION => { 'hbase.hstore.defaultengine.compactionpolicy.class' => 'com.test.App' } } ``` Let me take a closer look at it. -- 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. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org