You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Eli Collins (JIRA)" <ji...@apache.org> on 2009/12/16 00:29:18 UTC

[jira] Created: (HDFS-836) Make dot a valid HDFS path?

Make dot a valid HDFS path?
---------------------------

                 Key: HDFS-836
                 URL: https://issues.apache.org/jira/browse/HDFS-836
             Project: Hadoop HDFS
          Issue Type: New Feature
            Reporter: Eli Collins


What do people think of making "." a valid path in HDFS? The motivation is to allow users to create symlinks to the current directory in HDFS-245, eg see the following test for the current behavior:
{code}
  @Test
  /** Test create symlink to . */
  public void testCreateLinkToDot() throws IOException {
    Path dir  = new Path("/test");
    Path link = new Path("/test/linkToDot");
    fc.mkdir(dir, FileContext.DEFAULT_PERM, true);        
    fc.setWorkingDirectory(dir);
    try {
      fc.createSymlink(new Path("."), link);
      fail("Created symlink to dot");
      readFile(new Path("/test/linkToDot/file"));
    } catch (IOException x) {
      // Expected. Path(".") resolves to "" because URI normalizes
      // the dot away and AbstractFileSystem considers "" invalid.  
    }
    fc.delete(dir, true);
  }
{code}

This involves trade offs since Hadoop Paths represent URIs (rather than the path component of a URI) and in URIs dot normalizes away. Some options:
# Make symlinks to "." an exception per the above, though it seems odd to consider ".", "..", "/" etc invalid paths (and the latter two happen to work based on how the Path constructor initializes the URI even though isValidName in AbstractFileSystem would consider them invalid names.
# Making "." immediately parse to an absolute path would be poor symlink semantics (eg a link to "." should not break if you rename the link's parent directory). 
# Making Path special case this so "." doesn't normalize away would be a weird one off case where Path and URIs differ.

Other alternatives? Of the above I'd prefer the last one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.