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

Noah Watkins commented on HADOOP-11244:
---------------------------------------

Hmm, I think then I may be reading this code incorrectly.

Here we start writing to "target"

{noformat}
    touch(getFileSystem(), target);
    assertPathExists("original file does not exist", target);
    byte[] dataset = dataset(256, 'a', 'z');
    FSDataOutputStream outputStream = getFileSystem().append(target);
    outputStream.write(dataset);
{noformat}

Create the path object for "renamed". I'm assuming this has no side effects.

{noformat}
    Path renamed = new Path(testPath, "renamed");
{noformat}

Close the "target" stream, list the directory, and assert "renamed" file 
exists. 

{noformat}
    outputStream.close();
    String listing = ls(testPath);
    assertPathExists("renamed destination file does not exist", renamed);
{noformat}

I don't see anything in the code that would result in "renamed" being created. 
Am I getting the semantics of `new Path` wrong? Should that have side effects 
on the last opened output stream?

> The HCFS contract test testRenameFileBeingAppended doesn't do a rename
> ----------------------------------------------------------------------
>
>                 Key: HADOOP-11244
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11244
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Noah Watkins
>
> The test AbstractContractAppendTest::testRenameFileBeingAppended appears to 
> assert the behavior of renaming a file opened for writing. However, the 
> assertion "assertPathExists("renamed destination file does not exist", 
> renamed);" fails because it appears that the file "renamed" is never created 
> (ostensibly it should be the "target" file that has been renamed).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to