Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-1647

DistributedFileSystem.getFileStatus() fails for path "/"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 0.14.0, 0.15.0
    • 0.14.0
    • None
    • None

    Description

      DistributedFileSystem#getFileStatus throws the following exception when invoked with new Path("/"). LocalFileSystem does not. The code to produce this error is

       public static void main(String[] args) throws Exception{
          Configuration conf = new Configuration();
          FileSystem fs = FileSystem.get(conf);
          Path path = new Path("/");
          System.out.println("Path : \"" + path.toString() + "\"");
          System.out.println(fs.isDirectory(path));
          System.out.println(fs.getFileStatus(path).isDir()); 
        }
      

      for Local configuration the code prints :

      Path : "/"
      true
      true
      

      For a new formatted dfs with only one file /user/enis/file.txt, Path could not be created.

      Path : "/"
      false
      Exception in thread "main" org.apache.hadoop.ipc.RemoteException: java.io.IOException: java.lang.IllegalArgumentException: Can not create a Path from an empty string
              at org.apache.hadoop.fs.Path.checkPathArg(Path.java:82)
              at org.apache.hadoop.fs.Path.<init>(Path.java:90)
              at org.apache.hadoop.dfs.DFSFileInfo.<init>(DFSFileInfo.java:59)
              at org.apache.hadoop.dfs.FSDirectory.getFileInfo(FSDirectory.java:729)
              at org.apache.hadoop.dfs.FSNamesystem.getFileInfo(FSNamesystem.java:1301)
              at org.apache.hadoop.dfs.NameNode.getFileInfo(NameNode.java:488)
              at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:340)
              at org.apache.hadoop.ipc.Server$Handler.run(Server.java:566)
      
              at org.apache.hadoop.ipc.Client.call(Client.java:470)
              at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:165)
              at org.apache.hadoop.dfs.$Proxy0.getFileInfo(Unknown Source)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:82)
              at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:59)
              at org.apache.hadoop.dfs.$Proxy0.getFileInfo(Unknown Source)
              at org.apache.hadoop.dfs.DFSClient.getFileInfo(DFSClient.java:430)
              at org.apache.hadoop.dfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:319)
              at org.apache.hadoop.util.TestIsDir.main(TestIsDir.java:38)
      

      Attachments

        1. getFileStatusJavadoc.patch
          0.5 kB
          Enis Soztutar
        2. fileStatus3.patch
          5 kB
          Dhruba Borthakur

        Issue Links

          Activity

            People

              dhruba Dhruba Borthakur
              enis Enis Soztutar
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: