[
https://issues.apache.org/jira/browse/HDFS-7342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14218962#comment-14218962
]
Yongjun Zhang commented on HDFS-7342:
-------------------------------------
HI Ravi,
I worked out a version toward the direction I described in my last comment (use
{{getBlockManager().forceCompleteBlock}}).
Below are the main changes I made:
* I forgot one condition check in the snapshot of code change in my last
comment, revised as
{code}
if (lastBlockState == BlockUCState.COMMITTED) {
getBlockManager().forceCompleteBlock(pendingFile,
(BlockInfoUnderConstruction) lastBlock);
}
{code}
* Replace your original {{BlockInfoDdesired}} with the following
{code}
class BlockInfoUcDesired extends BlockInfoUnderConstruction {
BlockUCState desiredState;
BlockInfoUcDesired(BlockInfo blk, BlockUCState state) {
super(blk, (short)3);
desiredState = state;
setBlockCollection(blk.getBlockCollection());
}
@Override
public BlockUCState getBlockUCState() {
return desiredState;
}
}
{code}
* Replace
{code}
assert lm.getLeaseByPath(testFile.toString()).getHolder().equals(
HdfsServerConstants.NAMENODE_LEASE_HOLDER) : "Lease not recovered";
{code}
with
{code}
Lease lease = lm.getLeaseByPath(testFile.toString());
String leaseHolder = (lease == null) ? "" : lease.getHolder();
assert leaseHolder == "" ||
leaseHolder == HdfsServerConstants.NAMENODE_LEASE_HOLDER :
"Lease not recovered";
{code}
Would you please revise the patch with the above changes I suggested?
Notice that even though the tests now pass, there are some ERROR messages in
the test log file after the test finished. I studied a bit, and figured out
that it's because DFSClient tries to close all files at the very end of the
test, but the files were already closed by the leaseManager. So this kind of
ERROR msgs are expected based on my understanding.
BTW, there are some format changes needed in the test code you did, such as
shorten lines that's over 80, when splitting one line into two, the second part
need to have 4 spaces difference in the beginning etc.
Thanks a lot.
> Lease Recovery doesn't happen some times
> ----------------------------------------
>
> Key: HDFS-7342
> URL: https://issues.apache.org/jira/browse/HDFS-7342
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 2.0.0-alpha
> Reporter: Ravi Prakash
> Assignee: Ravi Prakash
> Attachments: HDFS-7342.1.patch, HDFS-7342.2.patch
>
>
> In some cases, LeaseManager tries to recover a lease, but is not able to.
> HDFS-4882 describes a possibility of that. We should fix this
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)