[ 
https://issues.apache.org/jira/browse/HDFS-7263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Konstantin Shvachko updated HDFS-7263:
--------------------------------------
    Attachment: TestSnapshotRead.java

Here is the test that fails with current implementation.
{{DFSInputStream}} should be fixed to take into account the actual file length 
and not try to read beyond it.
{code}
- realLen = (int) Math.min(realLen, locatedBlocks.getFileLength());
+ realLen = (int) Math.min(realLen, locatedBlocks.getFileLength() - pos);
{code}

> Snapshot read of an appended file returns more bytes than the file length.
> --------------------------------------------------------------------------
>
>                 Key: HDFS-7263
>                 URL: https://issues.apache.org/jira/browse/HDFS-7263
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.5.0
>            Reporter: Konstantin Shvachko
>         Attachments: TestSnapshotRead.java
>
>
> The following sequence of steps will produce extra bytes, that should not be 
> visible, because they are not in the snapshot.
> * Create a file of size L, where {{L % blockSize != 0}}.
> * Create a snapshot
> * Append bytes to the file
> * Read file in the snapshot (not the current file)
> * You will see the bytes are read beoynd the original file size L



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

Reply via email to