[ 
https://issues.apache.org/jira/browse/HDFS-16045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17352937#comment-17352937
 ] 

Xiangyi Zhu commented on HDFS-16045:
------------------------------------

[~hexiaoqiao]  Thank you very much for your comment. Presto uses the 
"UserGroupInformation#createProxyUser" method to create UGI, which needs to 
pass the real super user information (here should be related to Kerberos), and 
the "FileSystem#get" Api uses "UserGroupInformation#createRemoteUser" to create 
UGI. The latter does not require real user information, and the created UGI 
only contains information related to the user name, which means that the latter 
uses the same nature of the UGI created by the same user. I think they can 
share the same Filesystem instance.The consideration may not be comprehensive, 
welcome to discuss.

 
{code:java}
public static UserGroupInformation createRemoteUser(String user, AuthMethod 
authMethod) {
  if (user == null || user.isEmpty()) {
    throw new IllegalArgumentException("Null user");
  }
  Subject subject = new Subject();
  subject.getPrincipals().add(new User(user));
  UserGroupInformation result = new UserGroupInformation(subject);
  result.setAuthenticationMethod(authMethod);
  return result;
}{code}

> FileSystem.CACHE memory leak
> ----------------------------
>
>                 Key: HDFS-16045
>                 URL: https://issues.apache.org/jira/browse/HDFS-16045
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs
>    Affects Versions: 3.4.0
>            Reporter: Xiangyi Zhu
>            Priority: Major
>
> {code:java}
> FileSystem get(final URI uri, final Configuration conf,
>  final String user){code}
> When the client turns on the cache and uses the above API to specify the user 
> to create a Filesystem instance, the cache will be invalid.
> The specified user creates a new UGI every time he creates a Filesystem 
> instance, and cache compares it according to UGI.
> {code:java}
> public int hashCode() {
>  return (scheme + authority).hashCode() + ugi.hashCode() + (int)unique;
> }{code}
> Whether you can use username to replace UGI to make a comparison, and whether 
> there are other risks.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to