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

Jakob Homan commented on HDFS-8542:
-----------------------------------

* The checkstyle ding is a bit convoluted, but probably correct since the 
matching brace is nested pretty heavily.  Let's make checkstyle happy and give 
it what it wants.
* Please remove the println from the unit test
* Not sure it's worth caching the response here.  Home directories *shouldn't* 
change, but there's no huge reason why they couldn't between calls.  Since 
there's no way to clear the cache and this call is pretty light, I'd rather not 
cache.  Not caching will simplify the code.
* The existing org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java is 
incorrectly testing the getHomeDirectory method:
{code}    {//test GETHOMEDIRECTORY
      final URL url = webhdfs.toUrl(GetOpParam.Op.GETHOMEDIRECTORY, root);
      final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      final Map<?, ?> m = WebHdfsTestUtil.connectAndGetJson(
          conn, HttpServletResponse.SC_OK);
      assertEquals(WebHdfsFileSystem.getHomeDirectoryString(ugi),
          m.get(Path.class.getSimpleName()));
      conn.disconnect();
    }{code} 
since it's calling the static getHomeDirectoryString method rather than the 
instance getHomeDirectory method.  We should fix this and deprecate the static 
getHomeDirectoryString method since there's no use (or callers) for it.

Otherwise looks good.  Thanks.

> WebHDFS getHomeDirectory behavior does not match specification
> --------------------------------------------------------------
>
>                 Key: HDFS-8542
>                 URL: https://issues.apache.org/jira/browse/HDFS-8542
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: webhdfs
>    Affects Versions: 2.6.0
>            Reporter: Jakob Homan
>            Assignee: kanaka kumar avvaru
>         Attachments: HDFS-8542-00.patch, HDFS-8542-01.patch
>
>
> Per the 
> [spec|https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Get_Home_Directory],
>  WebHDFS provides a REST endpoint for getting the user's home directory:
> {noformat}Submit a HTTP GET request.
> curl -i "http://<HOST>:<PORT>/webhdfs/v1/?op=GETHOMEDIRECTORY"{noformat}
> However, WebHDFSFileSystem.java does not use this, instead building the home 
> [directory 
> locally|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java#L271]:
> {code}  /** @return the home directory. */
>   public static String getHomeDirectoryString(final UserGroupInformation ugi) 
> {
>     return "/user/" + ugi.getShortUserName();
>   }
>   @Override
>   public Path getHomeDirectory() {
>     return makeQualified(new Path(getHomeDirectoryString(ugi)));
>   }{code}
> The WebHDFSFileSystem client should call to the REST service to determine the 
> home directory.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to