dengzhhu653 commented on code in PR #6024:
URL: https://github.com/apache/hive/pull/6024#discussion_r2306875005


##########
service/src/java/org/apache/hive/service/server/HiveServer2.java:
##########
@@ -682,18 +683,18 @@ private void addConfsToPublish(HiveConf hiveConf, 
Map<String, String> confsToPub
    * @return
    * @throws Exception
    */
-  private static void setUpZooKeeperAuth(HiveConf hiveConf) throws Exception {
-    if (ZookeeperUtils.isKerberosEnabled(hiveConf)) {
-      String principal = 
hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
-      if (principal.isEmpty()) {
-        throw new IOException("HiveServer2 Kerberos principal is empty");
-      }
-      String keyTabFile = 
hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
-      if (keyTabFile.isEmpty()) {
-        throw new IOException("HiveServer2 Kerberos keytab is empty");
+  private static void setUpZooKeeperAuth(HiveConf hiveConf) {
+    try {
+      if (AuthType.isKerberosAuthMode(hiveConf) &&
+          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
+        String principal = 
hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);

Review Comment:
   Here the HS2 is kerberized, neither principal nor keytab should be empty, 
otherwise the HS2 will fail to start



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to