sankarh commented on a change in pull request #569: HIVE-21446 : Hive Server 
going OOM during hive external table replications
URL: https://github.com/apache/hive/pull/569#discussion_r266297006
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/parse/repl/CopyUtils.java
 ##########
 @@ -238,23 +249,54 @@ private boolean isSourceFileMismatch(FileSystem 
sourceFs, ReplChangeManager.File
     return false;
   }
 
+  private UserGroupInformation getProxyUser() throws LoginException, 
IOException {
+    if (copyAsUser == null) {
+      return null;
+    }
+    UserGroupInformation proxyUser = null;
+    int currentRetry = 0;
+    while (currentRetry <= MAX_IO_RETRY) {
+      try {
+        UserGroupInformation ugi = Utils.getUGI();
+        String currentUser = ugi.getShortUserName();
+        if (!currentUser.equals(copyAsUser)) {
+          proxyUser = UserGroupInformation.createProxyUser(
+                  copyAsUser, UserGroupInformation.getLoginUser());
+        }
+        return proxyUser;
+      } catch (IOException e) {
+        currentRetry++;
+        if (currentRetry <= MAX_IO_RETRY) {
+          LOG.warn("Unable to get UGI info", e);
 
 Review comment:
   Can log the retry number in the log msg.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to