David Tucker created HDFS-11169: ----------------------------------- Summary: 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 Priority: Minor
Start with a fresh deployment of HDFS. 1. Create a file. 2. AddBlock the file. 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-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org