You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/04/28 02:02:48 UTC

[2/4] hive git commit: HIVE-19324 : improve YARN queue check error message in Tez pool (Sergey Shelukhin, reviewed by Ashutosh Chauhan)

HIVE-19324 : improve YARN queue check error message in Tez pool (Sergey Shelukhin, reviewed by Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/596c8112
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/596c8112
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/596c8112

Branch: refs/heads/branch-3
Commit: 596c811253b4a1818fb11b6edafcf1f7e81b8949
Parents: 7cbd648
Author: sergey <se...@apache.org>
Authored: Fri Apr 27 18:55:48 2018 -0700
Committer: sergey <se...@apache.org>
Committed: Fri Apr 27 18:56:04 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hive/ql/exec/tez/YarnQueueHelper.java  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/596c8112/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java
----------------------------------------------------------------------
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 c9c859a..b762e68 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
@@ -52,25 +52,31 @@ public class YarnQueueHelper {
     lastKnownGoodUrl = 0;
   }
 
-  public void checkQueueAccess(String queueName, String userName) throws IOException {
+  public void checkQueueAccess(
+      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.
     int urlIx = lastKnownGoodUrl, lastUrlIx = ((urlIx == 0) ? rmNodes.length : urlIx) - 1;
     Exception firstError = null;
     while (true) {
       String node = rmNodes[urlIx];
+      String error = null;
+      boolean isCallOk = false;
       try {
-        String error = checkQueueAccessFromSingleRm("http://" + node + urlSuffix);
-        lastKnownGoodUrl = urlIx;
-        if (error == null) return; // null error message here means the user has access.
-        throw new HiveException(error.isEmpty()
-            ? (userName + " has no access to " + queueName) : error);
+        error = checkQueueAccessFromSingleRm("http://" + node + urlSuffix);
+        isCallOk = true;
       } catch (Exception ex) {
         LOG.warn("Cannot check queue access against RM " + node, ex);
         if (firstError == null) {
           firstError = ex;
         }
       }
+      if (isCallOk) {
+        lastKnownGoodUrl = urlIx;
+        if (error == null) return; // null error message here means the user has access.
+        throw new HiveException(error.isEmpty()
+            ? (userName + " has no access to " + queueName) : error);
+      }
       if (urlIx == lastUrlIx) {
         throw new IOException("Cannot access any RM service; first error", firstError);
       }