[
https://issues.apache.org/jira/browse/HDFS-8576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14584218#comment-14584218
]
Tsz Wo Nicholas Sze commented on HDFS-8576:
-------------------------------------------
I see your point now after checking the patch in more details. The summary
"Lease recovery returns false , eventhough recovery happens" is missing leading
since there is no lease recovery in this case, it only releases the lease.
Some minor comments on the patch:
- The javadoc is inaccurate as mentioned previously. Let's change it to "if
the file is already closed, or if the lease can be released and the file can be
closed."
{code}
+ * @return true if the file is already closed or if lease recovery
+ * is successful and file is closed.
{code}
- Rename recoverLeaseInternal to isClosed and declare it as final in
recoverLease.
- Let's change the following
{code}
boolean isClosed = internalReleaseLease(lease, src, iip, null);
if(!isClosed)
throw new RecoveryInProgressException(
op.getExceptionMessage(src, holder, clientMachine,
"lease recovery is in progress. Try again later."));
return isClosed;
{code}
to
{code}
if (internalReleaseLease(lease, src, iip, null)) {
return true;
} else {
throw new RecoveryInProgressException(
op.getExceptionMessage(src, holder, clientMachine,
"lease recovery is in progress. Try again later."));
}
{code}
- asFile() won't return null so that we can change the if-statement in
recoverLeaseInternal to:
{code}
INodeFile file = iip.getLastINode().asFile();
if (!file.isUnderConstruction()) {
return true;
} else {
...
}
{code}
Notice that we don't need "return false" at the end.
> 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
> Attachments: HDFS-8576.1.patch
>
>
> 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)