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

Daryn Sharp commented on HDFS-14384:
------------------------------------

The {{LocatedBlocks}} class appears fundamentally broken – a mutable located 
block list but an immutable last block, file size, etc.  Ignoring that, I'm 
initially confused by:
{code}
         locatedBlocks.insertRange(targetBlockIdx, 
newBlocks.getLocatedBlocks());
+
+        // Update the LastLocatedBlock, if offset is for last block.
+        if (offset >= locatedBlocks.getFileLength()) {
+          locatedBlocks = new LocatedBlocks(newBlocks.getFileLength(), .....
{code}

# Why go through the work of inserting the new blocks in the old block list 
when it's going to be thrown away?
# Why recreate locatedBlocks from newBlocks instead of just assigning newBlocks 
to locatedBlocks?


> When lastLocatedBlock token expire, it will take 1~3s second to refetch it.
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-14384
>                 URL: https://issues.apache.org/jira/browse/HDFS-14384
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.7.2
>            Reporter: Surendra Singh Lilhore
>            Assignee: Surendra Singh Lilhore
>            Priority: Major
>         Attachments: HDFS-14384.001.patch
>
>
> Scenario :
>  1. Write file with one block which is in-progress.
>   2. Open input stream and close the output stream.
>   3. Wait for block token expiration and read the data.
>   4. Last block read take 1~3 sec to read it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to