diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 0d8d7ae030d693c158dee6ef007acdfa9223175d..3809d78a23817b8eae78ac58c3d254c8bf3009a0 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -549,11 +549,11 @@ private static void populateLlapDaemonVarsSet(Set llapDaemonVarsSetLocal "If not set, defaults to the codec extension for text files (e.g. \".gz\"), or no extension otherwise."), HIVE_IN_TEST("hive.in.test", false, "internal usage only, true in test mode", true), - HIVE_IN_TEST_SHORT_LOGS("hive.in.test.short.logs", false, + HIVE_TESTING_SHORT_LOGS("hive.testing.short.logs", false, "internal usage only, used only in test mode. If set true, when requesting the " + "operation logs the short version (generated by LogDivertAppenderForTest) will be " + "returned"), - HIVE_IN_TEST_REMOVE_LOGS("hive.in.test.remove.logs", true, + HIVE_TESTING_REMOVE_LOGS("hive.testing.remove.logs", true, "internal usage only, used only in test mode. If set false, the operation logs, and the " + "operation log directory will not be removed, so they can be found after the test runs."), @@ -3774,7 +3774,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"); } @@ -3790,7 +3791,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 common/src/test/org/apache/hadoop/hive/conf/TestHiveConfRestrictList.java common/src/test/org/apache/hadoop/hive/conf/TestHiveConfRestrictList.java index adf3cfb1661385b4ec192cf451ddf37709ceee22..120b8afcd2dfadf97fdc1374b84783001e856173 100644 --- common/src/test/org/apache/hadoop/hive/conf/TestHiveConfRestrictList.java +++ common/src/test/org/apache/hadoop/hive/conf/TestHiveConfRestrictList.java @@ -51,7 +51,7 @@ public void testRestriction() throws Exception { @Test public void testMultipleRestrictions() throws Exception { verifyRestriction(ConfVars.HIVETESTMODEPREFIX.varname, "foo"); - verifyRestriction(ConfVars.HIVETESTMODE.varname, "false"); + verifyRestriction(ConfVars.HIVE_IN_TEST.varname, "true"); } /** diff --git itests/util/src/main/java/org/apache/hive/beeline/QFileBeeLineClient.java itests/util/src/main/java/org/apache/hive/beeline/QFileBeeLineClient.java index d67bf19a0a241e3801d0c95e5fd3a1a6a7b6b4d7..2f918349df71a9266cf3f5b15ad7527090366b52 100644 --- itests/util/src/main/java/org/apache/hive/beeline/QFileBeeLineClient.java +++ itests/util/src/main/java/org/apache/hive/beeline/QFileBeeLineClient.java @@ -80,8 +80,8 @@ private void beforeExecute(QFile qFile) throws Exception { "DROP DATABASE IF EXISTS `" + qFile.getDatabaseName() + "` CASCADE;", "CREATE DATABASE `" + qFile.getDatabaseName() + "`;", "USE `" + qFile.getDatabaseName() + "`;", - "set hive.in.test.short.logs=true;", - "set hive.in.test.remove.logs=false;", + "set hive.testing.short.logs=true;", + "set hive.testing.remove.logs=false;", }, qFile.getBeforeExecuteLogFile(), Converter.NONE); @@ -92,7 +92,7 @@ private void afterExecute(QFile qFile) throws Exception { beeLine.setIsTestMode(false); execute( new String[] { - "set hive.in.test.short.logs=false;", + "set hive.testing.short.logs=false;", "!set verbose true", "!set silent false", "!set showheader true", 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 856ed6771ba1a089df5d66d51f3973955b5183a4..2c4578a8e0af039b39342cda7d672bd7e1bf7dc5 100644 --- metastore/src/test/org/apache/hadoop/hive/metastore/datasource/TestDataSourceProviderFactory.java +++ metastore/src/test/org/apache/hadoop/hive/metastore/datasource/TestDataSourceProviderFactory.java @@ -164,4 +164,10 @@ public void testSetHikariCpBooleanProperty() throws SQLException { Assert.assertTrue(ds instanceof HikariDataSource); Assert.assertEquals(false, ((HikariDataSource)ds).isAllowPoolSuspension()); } + @Test(expected = IllegalArgumentException.class) + public void testBoneCPConfigCannotBeSet() { + conf.set(HiveConf.ConfVars.HIVE_CONF_RESTRICTED_LIST.name(), BoneCPDataSourceProvider.BONECP); + conf.verifyAndSet(BoneCPDataSourceProvider.BONECP + ".disableJMX", "true"); + } + } diff --git ql/src/java/org/apache/hadoop/hive/ql/session/OperationLog.java ql/src/java/org/apache/hadoop/hive/ql/session/OperationLog.java index 1d1fc4ebe51ec316376c9b9e8fd1610ae5a88f81..fc2800aa2e05dd84ff279a7d17ac2dc96497bcf7 100644 --- ql/src/java/org/apache/hadoop/hive/ql/session/OperationLog.java +++ ql/src/java/org/apache/hadoop/hive/ql/session/OperationLog.java @@ -63,8 +63,8 @@ public OperationLog(String name, File file, HiveConf hiveConf) { // If in test mod create a test log file which will contain only logs which are supposed to // be written to the qtest output if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST)) { - isRemoveLogs = hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST_REMOVE_LOGS); - if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST_SHORT_LOGS)) { + isRemoveLogs = hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_TESTING_REMOVE_LOGS); + if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_TESTING_SHORT_LOGS)) { testLogFile = new LogFile(new File(file.getAbsolutePath() + ".test")); isShortLogs = true; } else { diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java index f5d7ec06bdaf47965aaaa446cf599ddace3aa100..57bb53ca3f4820ba65e48aac59f86b5b90cacf5a 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java @@ -778,7 +778,7 @@ public void close() throws HiveSQLException { private void cleanupSessionLogDir() { // In case of test, if we might not want to remove the log directory - if (isOperationLogEnabled && sessionConf.getBoolVar(ConfVars.HIVE_IN_TEST_REMOVE_LOGS)) { + if (isOperationLogEnabled && sessionConf.getBoolVar(ConfVars.HIVE_TESTING_REMOVE_LOGS)) { try { FileUtils.forceDelete(sessionLogDir); LOG.info("Operation log session directory is deleted: "