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

Íñigo Goiri commented on HDFS-13972:
------------------------------------

I'm not sure if it's only me but the current approach looks a little hacky (I'm 
a little prejudiced against anything involving statics and ThreadLocals tbh).
The approach here would be that by default we get the user in the Router using 
{{Server.getRemoteUser()}}.
Here we are adding a way to set for the current thread the user we want to use.
So now, when we get the HTTP requests to create a file, we go through the 
internal {{chooseDatanode()}} in {{RouterWebHdfsMethods}} and then change the 
current user in the RouterRPCServer and then do the invokation.
This explains why the old {{loginUser.doAs()}} didn't work but it looks to me a 
little hard to follow.

What about creating an internal method in {{RouterRpcServer#getDatanodeReport}} 
which takes the UGI as a parameter and makes it go through all they way until 
{{RouterRpcClient}}?
Setting this kind of things through the API is easier to follow than through 
static and ThreadLocals.
I'm willing to be convinced otherwise but I want to bring this up.

In an unrelated note, can we add some test coverage for this and check which 
users is running what?

I also agree that we should have a follow up JIRA to do some caching of the DN 
reports and probably refactor this part.

> RBF: Support for Delegation Token (WebHDFS)
> -------------------------------------------
>
>                 Key: HDFS-13972
>                 URL: https://issues.apache.org/jira/browse/HDFS-13972
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Íñigo Goiri
>            Assignee: CR Hota
>            Priority: Major
>         Attachments: HDFS-13972-HDFS-13891.001.patch, 
> HDFS-13972-HDFS-13891.002.patch, HDFS-13972-HDFS-13891.003.patch, 
> HDFS-13972-HDFS-13891.004.patch, HDFS-13972-HDFS-13891.005.patch, 
> HDFS-13972-HDFS-13891.006.patch, HDFS-13972-HDFS-13891.007.patch, 
> HDFS-13972-HDFS-13891.008.patch, HDFS-13972-HDFS-13891.009.patch, 
> HDFS-13972-HDFS-13891.010.patch, HDFS-13972-HDFS-13891.011.patch, 
> HDFS-13972-HDFS-13891.012.patch, TestRouterWebHDFSContractTokens.java
>
>
> HDFS Router should support issuing HDFS delegation tokens through WebHDFS.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to