hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryn Sharp (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-2034) length in getBlockRange becomes -ve when reading only from currently being written blk
Date Mon, 06 Jun 2011 15:08:59 GMT

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

Daryn Sharp commented on HDFS-2034:

* I'd suggest changing {{"lastblkcomplete but read past that"}} to something more grammatically
correct (I'm not the police!) like {{"can't read past last completed block"}}.

* There's an assertion for reading past the last *completed* block, but not for reading past
the last *located* block?

* I found the names of the booleans to not be clear at face value.  Ie. I couldn't tell what
they meant if I didn't see the assignment.

For your consideration, maybe something like this with a sprinkling of comments:
if (locatedBlocks.isLastBlockComplete())
  assert(!readOffsetPastCompletedBlock) : "can't read past last completed block";

if (!readOffsetPastCompletedBlock) {
  if (readLengthPastCompletedBlock) {
    length = locatedBlocks.getFileLength() - offset;
  blocks = getFinalizedBlockRange(offset, length);
if (readOffsetPastCompletedBlock) {
  Block lastBlock = locatedBlocks.getLastLocatedBlock();
  long lastBlockEndOffset = lastBlock.getStartOffset() + lastBlock.getBlockSize();
  assert(offset < lastBlockEndOffset) : "can't read past last located block";

> length in getBlockRange becomes -ve when reading only from currently being written blk
> --------------------------------------------------------------------------------------
>                 Key: HDFS-2034
>                 URL: https://issues.apache.org/jira/browse/HDFS-2034
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: John George
>            Assignee: John George
>            Priority: Minor
>         Attachments: HDFS-2034.patch
> This came up during HDFS-1907. Posting an example that Todd posted in HDFS-1907 that
brought out this issue.
> {quote}
> Here's an example sequence to describe what I mean:
> 1. open file, write one and a half blocks
> 2. call hflush
> 3. another reader asks for the first byte of the second block
> {quote}
> In this case since offset is greater than the completed block length, the math in getBlockRange()
of DFSInputStreamer.java will set "length" to negative.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message