hadoop-hdfs-issues mailing list archives

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

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

Todd Lipcon commented on HDFS-2034:

Couple of small nits:
- rather than reassiging the {{length}} parameter, I think it would be clearer to just do:
blocks = getFinalizedBlockRange(offset, Math.min(length, lengthOfCompleteBlk - offset));
don't you think?

- when instantiating the ArrayList, pass a capacity of 1 since you know that it will have
at most 1 element. (the default capacity for ArrayList is 10)
- our style guide says to use curly braces even for one-line if statements. There are a couple
missing in the patch
- another style thing: for short inline comments it's usually preferred to {{//}} style comments
instead of {{/* ... */}} for whatever reason.

> 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-1.patch, HDFS-2034-1.patch, HDFS-2034-2.patch, HDFS-2034-3.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