hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jing Zhao (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-4545) Snapshot: unprotectedSetReplication may update diskspace count incorrectly
Date Mon, 04 Mar 2013 20:09:12 GMT

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

Jing Zhao commented on HDFS-4545:
---------------------------------

The patch looks good. Only a question about the changes in INodesInPath. For operations such
as renaming snapshots etc, INodeDirectory#getLastINodeInPath
will first be called, and INodesInPath#getINode(0) is called to get the correspond inode (i.e.,
FSDirectory#getINode). When a wrong path ending with ".snapshot" is given, before the change,
a null inode will be returned by this sequence of calls, and a FileNotFoundException will
be thrown to the end user. After the change, we will get an ArrayIndexOutOfBoundsException
in INodesInPath#getINode. An example testcase is:

{noformat}
  @Test
  public void testRenameSnapshotWithWrongPath() throws Exception {
    DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);
    // Create three snapshots for sub1
    SnapshotTestHelper.createSnapshot(hdfs, sub1, "s1");
    
    Path wrongPath = new Path(sub1, HdfsConstants.DOT_SNAPSHOT_DIR);
    try {
      hdfs.renameSnapshot(wrongPath, "s1", "s2");
      fail("");
    } catch (FileNotFoundException e) {}
  }
{noformat}

So I think we may also need to add extra check for paths ending with ".snapshot" for corresponding
operaitons (before trying to get the inode for the path).
                
> Snapshot: unprotectedSetReplication may update diskspace count incorrectly
> --------------------------------------------------------------------------
>
>                 Key: HDFS-4545
>                 URL: https://issues.apache.org/jira/browse/HDFS-4545
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: namenode
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Tsz Wo (Nicholas), SZE
>         Attachments: h4545_20130304.patch
>
>
> FSDirectory.unprotectedSetReplication changes file replication but it may or may not
changes block replication.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message