diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 2fb004c0ecea6d371a3a18e4d0eab19e5b80af55..6010a71243fc417557346b0ae59ca1ad46990ff3 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -3765,7 +3765,8 @@ public void verifyAndSet(String name, String value) throws IllegalArgumentExcept + "It is not in list of params that are allowed to be modified at runtime"); } } - if (Iterables.any(restrictList, restrictedVar -> restrictedVar.startsWith(name))) { + if (Iterables.any(restrictList, + restrictedVar -> name != null && name.startsWith(restrictedVar))) { throw new IllegalArgumentException("Cannot modify " + name + " at runtime. It is in the list" + " of parameters that can't be modified at runtime or is prefixed by a restricted variable"); } @@ -3781,7 +3782,7 @@ public void verifyAndSet(String name, String value) throws IllegalArgumentExcept } public boolean isHiddenConfig(String name) { - return hiddenSet.contains(name); + return Iterables.any(hiddenSet, hiddenVar -> name.startsWith(hiddenVar)); } /** diff --git common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java index c914d2332dc645af2de5f85c6ce8b36c6e09b3dc..1fac2b0966a0fe45d57eef38f23acf43de02307e 100644 --- common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java +++ common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java @@ -138,6 +138,7 @@ public void testHiddenConfig() throws Exception { try { final String name = HiveConf.ConfVars.HIVE_CONF_HIDDEN_LIST.varname; conf.verifyAndSet(name, ""); + conf.verifyAndSet(name + "postfix", ""); Assert.fail("Setting config property " + name + " should fail"); } catch (IllegalArgumentException e) { // the verifyAndSet in this case is expected to fail with the IllegalArgumentException @@ -147,6 +148,9 @@ public void testHiddenConfig() throws Exception { conf2.set(HiveConf.ConfVars.METASTOREPWD.varname, "password"); conf2.set(HiveConf.ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname, "password"); conf.stripHiddenConfigurations(conf2); + Assert.assertTrue(conf.isHiddenConfig(HiveConf.ConfVars.METASTOREPWD.varname + "postfix")); + Assert.assertTrue( + conf.isHiddenConfig(HiveConf.ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname + "postfix")); Assert.assertEquals("", conf2.get(HiveConf.ConfVars.METASTOREPWD.varname)); Assert.assertEquals("", conf2.get(HiveConf.ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname)); } diff --git metastore/src/test/org/apache/hadoop/hive/metastore/datasource/TestDataSourceProviderFactory.java metastore/src/test/org/apache/hadoop/hive/metastore/datasource/TestDataSourceProviderFactory.java index 628460482dc646f8a38f607e815eddaa3cc2a831..7b0869c96fc44bb76ab9aa783c5725d5d9f15108 100644 --- metastore/src/test/org/apache/hadoop/hive/metastore/datasource/TestDataSourceProviderFactory.java +++ metastore/src/test/org/apache/hadoop/hive/metastore/datasource/TestDataSourceProviderFactory.java @@ -104,4 +104,10 @@ public void testSetBoneCpBooleanProperty() throws SQLException { Assert.assertTrue(ds instanceof BoneCPDataSource); Assert.assertEquals(true, ((BoneCPDataSource)ds).isDisableJMX()); } + + @Test(expected = IllegalArgumentException.class) + public void testBoneCPConfigCannotBeSet() { + conf.verifyAndSet(BoneCPDataSourceProvider.BONECP + ".disableJMX", "true"); + } + }