You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by fo...@apache.org on 2023/01/04 03:32:39 UTC

[hudi] 29/45: Fix tauth issue (merge request !102)

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

forwardxu pushed a commit to branch release-0.12.1
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit f7fe437faf8f0d7ec358076973aec49a0d9e29ff
Author: superche <su...@tencent.com>
AuthorDate: Wed Nov 23 16:43:27 2022 +0800

    Fix tauth issue (merge request !102)
    
    Squash merge branch 'fix_tauth_issue' into 'release-0.12.1'
    <img width="" src="/uploads/96CCBC0A860C477FBA33C4AAE4965D3B/图片" alt="图片" />
    
    原因:`UserGroupInformation`在`presto work`节点中的用户信息改变为默认的`root`,导致Tauth认证失败;
    
    解决:在获取`fileSystem`之前,都进行`UserGroupInformation.setConfiguration(hadoopConf.get());`
---
 hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java        | 2 ++
 .../java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java b/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java
index 1350108a11..15a729a812 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java
@@ -18,6 +18,7 @@
 
 package org.apache.hudi.common.fs;
 
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hudi.common.config.HoodieMetadataConfig;
 import org.apache.hudi.common.config.SerializableConfiguration;
 import org.apache.hudi.common.engine.HoodieEngineContext;
@@ -107,6 +108,7 @@ public class FSUtils {
     FileSystem fs;
     prepareHadoopConf(conf);
     try {
+      UserGroupInformation.setConfiguration(conf);
       fs = path.getFileSystem(conf);
     } catch (IOException e) {
       throw new HoodieIOException("Failed to get instance of " + FileSystem.class.getName(), e);
diff --git a/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java b/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
index bcfd891711..db1eeaed7e 100644
--- a/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
+++ b/hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java
@@ -18,6 +18,7 @@
 
 package org.apache.hudi.metadata;
 
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hudi.avro.model.HoodieMetadataColumnStats;
 import org.apache.hudi.common.bloom.BloomFilter;
 import org.apache.hudi.common.config.SerializableConfiguration;
@@ -96,6 +97,7 @@ public class FileSystemBackedTableMetadata implements HoodieTableMetadata {
         // result below holds a list of pair. first entry in the pair optionally holds the deduced list of partitions.
         // and second entry holds optionally a directory path to be processed further.
         List<Pair<Option<String>, Option<Path>>> result = engineContext.map(dirToFileListing, fileStatus -> {
+          UserGroupInformation.setConfiguration(hadoopConf.get());
           FileSystem fileSystem = fileStatus.getPath().getFileSystem(hadoopConf.get());
           if (fileStatus.isDirectory()) {
             if (HoodiePartitionMetadata.hasPartitionMetadata(fileSystem, fileStatus.getPath())) {