You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by dk...@apache.org on 2025/11/17 08:44:07 UTC

(hive) 02/05: HIVE-29304: HS2 fails to start if cluster is configured with a mix of LDAP and Kerberos (#6166)

This is an automated email from the ASF dual-hosted git repository.

dkuzmenko pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/hive.git

commit c6e577ca1fa9306a00ed087df67c46fb2c4500fe
Author: dengzh <de...@gmail.com>
AuthorDate: Thu Nov 13 09:14:07 2025 +0800

    HIVE-29304: HS2 fails to start if cluster is configured with a mix of LDAP and Kerberos (#6166)
    
    (cherry picked from commit 8d7c9c42f76bbd0a258640b038ac305b9e71169d)
---
 jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java | 2 +-
 service/src/java/org/apache/hive/service/server/HiveServer2.java  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java b/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java
index 6ab722b7371..00ef4785a70 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java
@@ -208,7 +208,7 @@ static void configureConnParams(JdbcConnectionParams connParams) throws ZooKeepe
       try (CuratorFramework zooKeeperClient = getZkClient(connParams)) {
         final List<String> serverHosts = getServerHosts(connParams, zooKeeperClient);
         if (serverHosts.isEmpty()) {
-          throw new ZooKeeperHiveClientException("No more HiveServer2 URIs from ZooKeeper to attempt");
+          throw new ZooKeeperHiveClientException("Empty HiveServer2 URIs found from ZooKeeper to attempt");
         }
         // Pick a server node randomly
         final String serverNode = serverHosts.get(ThreadLocalRandom.current().nextInt(serverHosts.size()));
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index c145283c120..ced00eeb100 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -99,6 +99,7 @@
 import org.apache.hadoop.hive.ql.txn.compactor.Worker;
 import org.apache.hadoop.hive.shims.ShimLoader;
 import org.apache.hadoop.hive.common.IPStackUtils;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.ExitUtil;
 import org.apache.hive.common.util.HiveStringUtils;
 import org.apache.hive.common.util.HiveVersionInfo;
@@ -606,7 +607,7 @@ public static boolean isAllTransportMode(HiveConf hiveConf) {
 
   private ACLProvider getACLProvider(HiveConf hiveConf) {
     final boolean isSecure =
-        AuthType.isKerberosAuthMode(hiveConf) &&
+        UserGroupInformation.isSecurityEnabled() &&
         HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_ZOOKEEPER_USE_KERBEROS);
 
     return new ACLProvider() {
@@ -683,7 +684,7 @@ private void addConfsToPublish(HiveConf hiveConf, Map<String, String> confsToPub
    */
   private static void setUpZooKeeperAuth(HiveConf hiveConf) {
     try {
-      if (AuthType.isKerberosAuthMode(hiveConf) &&
+      if (UserGroupInformation.isSecurityEnabled() &&
           StringUtils.isNotEmpty(HiveConf.getVar(hiveConf, HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM)) &&
           HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_ZOOKEEPER_USE_KERBEROS)) {
         // Install the JAAS Configuration for the runtime