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 2022/06/28 09:00:03 UTC

[hive] branch master updated: HIVE-26352: Tez queue access check fails with GSS Exception on Compaction (Laszlo Vegh, reviewed by Denys Kuzmenko)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3e10f6cea4 HIVE-26352: Tez queue access check fails with GSS Exception on Compaction (Laszlo Vegh, reviewed by Denys Kuzmenko)
3e10f6cea4 is described below

commit 3e10f6cea424308dd826c7bab7013bdd507dbff1
Author: veghlaci05 <90...@users.noreply.github.com>
AuthorDate: Tue Jun 28 10:59:49 2022 +0200

    HIVE-26352: Tez queue access check fails with GSS Exception on Compaction (Laszlo Vegh, reviewed by Denys Kuzmenko)
    
    Closes #3402
---
 .../hadoop/hive/ql/exec/tez/YarnQueueHelper.java      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java
index 14a9560089..88322556c0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java
@@ -23,10 +23,12 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -92,6 +94,23 @@ public class YarnQueueHelper {
   }
 
   public void checkQueueAccess(
+      String queueName, String userName) throws IOException, InterruptedException {
+    UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
+    try {
+      ugi.doAs((PrivilegedExceptionAction<Void>) () -> {
+        checkQueueAccessInternal(queueName, userName);
+        return null;
+      });
+    } finally {
+      try {
+        FileSystem.closeAllForUGI(ugi);
+      } catch (IOException exception) {
+        LOG.error("Could not clean up file-system handles for UGI: " + ugi, exception);
+      }
+    }
+  }
+
+  private void checkQueueAccessInternal(
       String queueName, String userName) throws IOException, HiveException {
     String urlSuffix = String.format(PERMISSION_PATH, queueName, userName);
     // TODO: if we ever use this endpoint for anything else, refactor cycling into a separate class.