Skip to content

Commit 8d7c9c4

Browse files
authored
HIVE-29304: HS2 fails to start if cluster is configured with a mix of LDAP and Kerberos (#6166)
1 parent c054a47 commit 8d7c9c4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static void configureConnParams(JdbcConnectionParams connParams) throws ZooKeepe
208208
try (CuratorFramework zooKeeperClient = getZkClient(connParams)) {
209209
final List<String> serverHosts = getServerHosts(connParams, zooKeeperClient);
210210
if (serverHosts.isEmpty()) {
211-
throw new ZooKeeperHiveClientException("No more HiveServer2 URIs from ZooKeeper to attempt");
211+
throw new ZooKeeperHiveClientException("Empty HiveServer2 URIs found from ZooKeeper to attempt");
212212
}
213213
// Pick a server node randomly
214214
final String serverNode = serverHosts.get(ThreadLocalRandom.current().nextInt(serverHosts.size()));

service/src/java/org/apache/hive/service/server/HiveServer2.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
import org.apache.hadoop.hive.ql.txn.compactor.Worker;
100100
import org.apache.hadoop.hive.shims.ShimLoader;
101101
import org.apache.hadoop.hive.common.IPStackUtils;
102+
import org.apache.hadoop.security.UserGroupInformation;
102103
import org.apache.hadoop.util.ExitUtil;
103104
import org.apache.hive.common.util.HiveStringUtils;
104105
import org.apache.hive.common.util.HiveVersionInfo;
@@ -606,7 +607,7 @@ public static boolean isAllTransportMode(HiveConf hiveConf) {
606607

607608
private ACLProvider getACLProvider(HiveConf hiveConf) {
608609
final boolean isSecure =
609-
AuthType.isKerberosAuthMode(hiveConf) &&
610+
UserGroupInformation.isSecurityEnabled() &&
610611
HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_ZOOKEEPER_USE_KERBEROS);
611612

612613
return new ACLProvider() {
@@ -683,7 +684,7 @@ private void addConfsToPublish(HiveConf hiveConf, Map<String, String> confsToPub
683684
*/
684685
private static void setUpZooKeeperAuth(HiveConf hiveConf) {
685686
try {
686-
if (AuthType.isKerberosAuthMode(hiveConf) &&
687+
if (UserGroupInformation.isSecurityEnabled() &&
687688
StringUtils.isNotEmpty(HiveConf.getVar(hiveConf, HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM)) &&
688689
HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_ZOOKEEPER_USE_KERBEROS)) {
689690
// Install the JAAS Configuration for the runtime

0 commit comments

Comments
 (0)