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

J.Andreina commented on HDFS-8576:
----------------------------------

Thanks [~szetszwo] for having a look at this issue. 

My expectation on invoking recoverlease is to return true when:
        *1. File is already closed*
        *2. Lease Recovery is successful and file is closed.*

Say consider following scenario
Step 1:  Client1 created a file with 0 byte or file with blocks in finalized. 
Client1 is aborted
Step 2:  Explicit Lease recovery is triggered.

As per current implementation , lease recovery will be successful on first try 
, but still it returns false.
{code}
Rex@XXXXXXXXX:~/hadoop/bin>./hdfs dfs -appendToFile hadoop /Test_file1
appendToFile: Failed to APPEND_FILE /Test_file1 for 
DFSClient_NONMAPREDUCE_-899478418_1 on XXXXXXXXX because this file lease is 
currently owned by DFSClient_NONMAPREDUCE_1903738807_1 on YYYYYYYYYYYYY

Rex@XXXXXXXXX:~/hadoop/bin> ./hdfs debug recoverLease -path /Test_file1
recoverLease returned false.
Giving up on recoverLease for /Test_file1 after 1 try.

Rex@XXXXXXXXX:~/hadoop/bin> echo $?
1
Rex@XXXXXXXXX:~/hadoop/bin> ./hdfs dfs -appendToFile hadoop /Test_file1
Rex@XXXXXXXXX:~/hadoop/bin> echo $?
0
{code}

*Expected* is to return successful on first try. Attached an initial patch for 
the same. 
Please review and give your feedback.

>  Lease recovery returns false , eventhough recovery happens.
> ------------------------------------------------------------
>
>                 Key: HDFS-8576
>                 URL: https://issues.apache.org/jira/browse/HDFS-8576
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: J.Andreina
>            Assignee: J.Andreina
>
> FSNamesystem#recoverLease , returns false eventhough lease recover happens. 
> Hence only on second retry for recovering lease on a file ,returns success 
> after checking if the file is not underconstruction.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to