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

Uma Maheswara Rao G commented on HDFS-15370:
--------------------------------------------

Thank you [~smajeti] for reporting it. I think you are right, in listStatus we 
have checks for isLink but we don't have it for getFileStatus.

I think the motivation of showing the isDir as false was probably due to the 
fact that they are links. By not representing link as regular directories in 
ls, would create less confusions on navigating in tree. If any others remembers 
the motivations why it was done like that please feel free to comment.

Coming to getFileStatus, I think we can make it similar to listStatus.

 ListStatus checks:

 
{code:java}
if (inode.isLink()) {
          INodeLink<FileSystem> link = (INodeLink<FileSystem>) inode;
 
          result[i++] = new FileStatus(0, false, 0, 0,
            creationTime, creationTime, PERMISSION_555,
            ugi.getShortUserName(), ugi.getPrimaryGroupName(),
            link.getTargetLink(),
            new Path(inode.fullPath).makeQualified(
                myUri, null));
        } else {
          result[i++] = new FileStatus(0, true, 0, 0,
            creationTime, creationTime, PERMISSION_555,
            ugi.getShortUserName(), ugi.getGroupNames()[0],
            new Path(inode.fullPath).makeQualified(
                myUri, null));
        }
{code}
 

GetFileStatus:

 
{code:java}
return new FileStatus(0, true, 0, 0, creationTime, creationTime,
          PERMISSION_555, ugi.getShortUserName(), ugi.getPrimaryGroupName(),
 
          new Path(theInternalDir.fullPath).makeQualified(
              myUri, ROOT_PATH));
 
{code}
 

 

> listStatus and getFileStatus behave inconsistent in the case of ViewFs 
> implementation for isDirectory
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-15370
>                 URL: https://issues.apache.org/jira/browse/HDFS-15370
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs
>    Affects Versions: 3.0.0, 3.1.0
>            Reporter: Srinivasu Majeti
>            Priority: Major
>              Labels: viewfs
>
> listStatus implementation in ViewFs and getFileStatus does not return 
> consistent values for an element on isDirectory value. listStatus returns 
> isDirectory of all softlinks as false and getFileStatus returns isDirectory 
> as true.
> {code:java}
> [hdfs@c3121-node2 ~]$ /usr/jdk64/jdk1.8.0_112/bin/java -cp `hadoop 
> classpath`:./hdfs-append-1.0-SNAPSHOT.jar LauncherGetFileStatus "/"
> FileStatus of viewfs://c3121/testme21may isDirectory:false
> FileStatus of viewfs://c3121/tmp isDirectory:false
> FileStatus of viewfs://c3121/foo isDirectory:false
> FileStatus of viewfs://c3121/tmp21may isDirectory:false
> FileStatus of viewfs://c3121/testme isDirectory:false
> FileStatus of viewfs://c3121/testme2 isDirectory:false <--- returns false
> FileStatus of / isDirectory:true
> [hdfs@c3121-node2 ~]$ /usr/jdk64/jdk1.8.0_112/bin/java -cp `hadoop 
> classpath`:./hdfs-append-1.0-SNAPSHOT.jar LauncherGetFileStatus /testme2
> FileStatus of viewfs://c3121/testme2/dist-copynativelibs.sh isDirectory:false
> FileStatus of viewfs://c3121/testme2/newfolder isDirectory:true
> FileStatus of /testme2 isDirectory:true <--- returns true
> [hdfs@c3121-node2 ~]$ {code}



--
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