You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/02/02 14:34:59 UTC

[GitHub] [hive] klcopp commented on a change in pull request #1937: HIVE-24719: There's a getAcidState call without impersonation in compactor.Worker

klcopp commented on a change in pull request #1937:
URL: https://github.com/apache/hive/pull/1937#discussion_r568649192



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -574,6 +573,35 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
     return true;
   }
 
+  /**
+   * Just AcidUtils.getAcidState, but with impersonation if needed.
+   */
+  private AcidDirectory getAcidStateForWorker(CompactionInfo ci, StorageDescriptor sd,
+          ValidCompactorWriteIdList tblValidWriteIds) throws IOException, InterruptedException {
+    Ref<AcidDirectory> acidDirectoryRef = Ref.from(null);
+    if (runJobAsSelf(ci.runAs)) {
+      acidDirectoryRef.value = AcidUtils.getAcidState(null, new Path(sd.getLocation()), conf,
+              tblValidWriteIds, Ref.from(false), true);
+    } else {
+      UserGroupInformation ugi = UserGroupInformation.createProxyUser(ci.runAs, UserGroupInformation.getLoginUser());
+      try {
+        ugi.doAs((PrivilegedExceptionAction<Object>) () -> {
+          acidDirectoryRef.value = AcidUtils.getAcidState(null, new Path(sd.getLocation()), conf,
+                  tblValidWriteIds, Ref.from(false), true);
+          return null;
+        });

Review comment:
       Done!




----------------------------------------------------------------
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:
users@infra.apache.org



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