You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by da...@apache.org on 2018/06/14 04:26:05 UTC
hive git commit: HIVE-19775: should use HS2 embedded mode in
privileged auth mode (Daniel Dai, reviewed by Thejas Nair)
Repository: hive
Updated Branches:
refs/heads/master 086700efa -> 1bcf40329
HIVE-19775: should use HS2 embedded mode in privileged auth mode (Daniel Dai, reviewed by Thejas Nair)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1bcf4032
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1bcf4032
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1bcf4032
Branch: refs/heads/master
Commit: 1bcf403299c6c3a562d518d5a63791ecf1372f2c
Parents: 086700e
Author: Daniel Dai <da...@gmail.com>
Authored: Wed Jun 13 21:25:40 2018 -0700
Committer: Daniel Dai <da...@gmail.com>
Committed: Wed Jun 13 21:25:40 2018 -0700
----------------------------------------------------------------------
.../org/apache/hive/beeline/HiveSchemaTool.java | 2 +-
.../hive/common/util/ShutdownHookManager.java | 8 ++++--
.../org/apache/hive/jdbc/HiveConnection.java | 4 +--
.../thrift/EmbeddedThriftBinaryCLIService.java | 27 ++++++++++++++++----
.../hive/metastore/tools/HiveSchemaHelper.java | 6 +++--
5 files changed, 35 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/1bcf4032/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
index 262eaa2..2cebe72 100644
--- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
+++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
@@ -1558,6 +1558,6 @@ public class HiveSchemaTool {
System.exit(1);
}
System.out.println("schemaTool completed");
-
+ System.exit(0);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1bcf4032/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java b/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
index a1fef29..fd12b64 100644
--- a/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
+++ b/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
@@ -26,6 +26,8 @@ import java.util.Set;
import org.apache.hadoop.fs.FileSystem;
import com.google.common.annotations.VisibleForTesting;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This is just a wrapper around hadoop's ShutdownHookManager but also manages delete on exit hook for temp files.
@@ -36,6 +38,8 @@ public class ShutdownHookManager {
private static final DeleteOnExitHook DELETE_ON_EXIT_HOOK = new DeleteOnExitHook();
+ static final private Logger LOG = LoggerFactory.getLogger(ShutdownHookManager.class.getName());
+
static {
MGR.addShutdownHook(DELETE_ON_EXIT_HOOK, -1);
}
@@ -93,7 +97,7 @@ public class ShutdownHookManager {
*/
public static void deleteOnExit(File file) {
if (MGR.isShutdownInProgress()) {
- throw new IllegalStateException("Shutdown in progress, cannot add a deleteOnExit");
+ LOG.warn("Shutdown in progress, cannot add a deleteOnExit");
}
DELETE_ON_EXIT_HOOK.deleteTargets.add(file);
}
@@ -103,7 +107,7 @@ public class ShutdownHookManager {
*/
public static void cancelDeleteOnExit(File file) {
if (MGR.isShutdownInProgress()) {
- throw new IllegalStateException("Shutdown in progress, cannot cancel a deleteOnExit");
+ LOG.warn("Shutdown in progress, cannot cancel a deleteOnExit");
}
DELETE_ON_EXIT_HOOK.deleteTargets.remove(file);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1bcf4032/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
index 30b6daf..458158e 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
@@ -202,9 +202,9 @@ public class HiveConnection implements java.sql.Connection {
if (isEmbeddedMode) {
EmbeddedThriftBinaryCLIService embeddedClient = new EmbeddedThriftBinaryCLIService();
- embeddedClient.init(null);
+ embeddedClient.init(null, connParams.getHiveConfs());
client = embeddedClient;
-
+ connParams.getHiveConfs().clear();
// open client session
openSession();
executeInitSql();
http://git-wip-us.apache.org/repos/asf/hive/blob/1bcf4032/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
index accba80..8b61874 100644
--- a/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
+++ b/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
@@ -18,6 +18,8 @@
package org.apache.hive.service.cli.thrift;
+import java.util.Map;
+
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.cli.CLIService;
import org.apache.hive.service.cli.ICLIService;
@@ -37,11 +39,26 @@ public class EmbeddedThriftBinaryCLIService extends ThriftBinaryCLIService {
@Override
public synchronized void init(HiveConf hiveConf) {
- // Null HiveConf is passed in jdbc driver side code since driver side is supposed to be
- // independent of conf object. Create new HiveConf object here in this case.
- if (hiveConf == null) {
- hiveConf = new HiveConf();
- }
+ init(hiveConf, null);
+ }
+
+ public synchronized void init(HiveConf hiveConf, Map<String, String> confOverlay) {
+ // Null HiveConf is passed in jdbc driver side code since driver side is supposed to be
+ // independent of conf object. Create new HiveConf object here in this case.
+ if (hiveConf == null) {
+ hiveConf = new HiveConf();
+ }
+ // Set the specific parameters if needed
+ if (confOverlay != null && !confOverlay.isEmpty()) {
+ // apply overlay query specific settings, if any
+ for (Map.Entry<String, String> confEntry : confOverlay.entrySet()) {
+ try {
+ hiveConf.set(confEntry.getKey(), confEntry.getValue());
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException("Error applying statement specific settings", e);
+ }
+ }
+ }
cliService.init(hiveConf);
cliService.start();
super.init(hiveConf);
http://git-wip-us.apache.org/repos/asf/hive/blob/1bcf4032/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
index 70746e8..1dd97f2 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
@@ -44,9 +44,11 @@ public class HiveSchemaHelper {
public static final String DB_MYSQL = "mysql";
public static final String DB_POSTGRACE = "postgres";
public static final String DB_ORACLE = "oracle";
- public static final String EMBEDDED_HS2_URL = "jdbc:hive2://";
+ public static final String EMBEDDED_HS2_URL =
+ "jdbc:hive2://?hive.conf.restricted.list=;hive.security.authorization.sqlstd.confwhitelist=*;"
+ + "hive.security.authorization.sqlstd.confwhitelist.append=*;hive.security.authorization.enabled=false;"
+ + "hive.metastore.uris=";
public static final String HIVE_JDBC_DRIVER = "org.apache.hive.jdbc.HiveDriver";
-
/***
* Get JDBC connection to metastore db