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

Uma Maheswara Rao G commented on HDFS-4516:
-------------------------------------------

Recovery also will not happen because, if there are no locations, we can not 
recover.
{code}
if (replicas.size() == 0) {
      NameNode.stateChangeLog.warn("BLOCK*"
        + " BlockInfoUnderConstruction.initLeaseRecovery:"
        + " No blocks found, lease removed.");
    }
{code}

In this situation clients also will see last block locations as 0. But we are 
assuming here that DNs might not have reported and we will retry for 3 times 
and read will fail. Here currently there is no way to detect whether blocks are 
created in DN or not.

One idea, What I am having is. When we create block immediate we should not 
have length as 0, because this block might not yet created in DN. Initial block 
length can be set as -1 when allocating in NN. Once DN reports block receving 
then we can set the length to 0. 
By this time if client synced with some data, anyway that size will be 
persisted. When block receiving request comes from DN to NN, NN will update 
length to 0 if and only if length is -1. Otherwise it can leave as is, because 
it might have synced with some data and updated that length.

And client can check, if last block length is -1, then direct it can return 0, 
because DNs not yet created and reported (or) not synced by client. We have to 
be care where and used block.getNumButes method take actions accordingly. 



                
> Client crash after block allocation and NN switch before lease recovery for 
> the same file can cause readers to fail forever
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-4516
>                 URL: https://issues.apache.org/jira/browse/HDFS-4516
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 3.0.0, 2.0.3-alpha
>            Reporter: Uma Maheswara Rao G
>            Priority: Critical
>
> If client crashes just after allocating block( blocks not yet created in DNs) 
> and NN also switched after this, then new Namenode will not know about locs.
> Further details will be in comment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to