hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqun Lin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-11169) GetBlockLocations returns a block when offset > filesize and file only has 1 block
Date Thu, 24 Nov 2016 12:53:59 GMT

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

Yiqun Lin commented on HDFS-11169:
----------------------------------

I think this is a good find! Thanks David for reporting this, the proposal makes sense for
me.  I have tested this in my local . Attach a initial patch to have a fix. I add a simple
test to exam the change. Kindly review. Thanks.

> GetBlockLocations returns a block when offset > filesize and file only has 1 block
> ----------------------------------------------------------------------------------
>
>                 Key: HDFS-11169
>                 URL: https://issues.apache.org/jira/browse/HDFS-11169
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.7.1
>         Environment: HDP 2.5, Ambari 2.4
>            Reporter: David Tucker
>            Assignee: Yiqun Lin
>            Priority: Minor
>
> Start with a fresh deployment of HDFS.
> 1. Create a file.
> 2. AddBlock the file with an offest larger than the file size.
> 3. Call GetBlockLocations.
> Expectation: 0 blocks are returned because the only added block is incomplete.
> Observation: 1 block is returned.
> This only seems to occur when 1 block is in play (i.e. if you write a block and call
AddBlock again, GetBlockLocations seems to behave as expected).
> This seems to be related to HDFS-513.
> I suspect the following line needs revision: https://github.com/apache/hadoop/blob/4484b48498b2ab2a40a404c487c7a4e875df10dc/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java#L1062
> I believe it should be >= instead of >:
>     if (nrBlocks >= 0 && curBlk == nrBlocks)   // offset >= end of file



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message