hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eli Collins (JIRA)" <j...@apache.org>
Subject [jira] Created: (HDFS-836) Make dot a valid HDFS path?
Date Tue, 15 Dec 2009 23:29:18 GMT
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.


Mime
View raw message