[
https://issues.apache.org/jira/browse/HADOOP-12484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14961278#comment-14961278
]
Chris Nauroth commented on HADOOP-12484:
----------------------------------------
Hello [~gouravk].
{code}
try {
SelfRenewingLease lease = fs.acquireLease(srcFile);
// Delete the file. This will free the lease too.
fs.getStoreInterface().delete(srcName, lease);
} catch(AzureException e) {
{code}
If {{acquireLease}} succeeds, but then the {{delete}} fails, then this will
leak the lease. Can you please use a {{finally}} block to guarantee that the
lease gets released in all code paths? You can look at other points in the
class that acquire and free a lease for an existing example.
Could you please review the checkstyle and whitespace warnings from the
pre-commit run and fix them?
If it's not feasible to write a unit test to simulate the race condition, then
can you please describe any manual testing that you've done to verify the
change?
Thank you!
> Single File Rename Throws Incorrectly In Potential Race Condition Scenarios
> ---------------------------------------------------------------------------
>
> Key: HADOOP-12484
> URL: https://issues.apache.org/jira/browse/HADOOP-12484
> Project: Hadoop Common
> Issue Type: Bug
> Components: tools
> Reporter: Gaurav Kanade
> Assignee: Gaurav Kanade
> Attachments: HADOOP-12484.01.patch
>
>
> FinishSingleFileRename function - in the case where src and dst both exist
> gets a lease on src blob to block write access and then deletes the file.
> However in the time between checking existence of source file and acquiring
> lease the file may be deleted by another process (race condition). Presently
> the function simply throws in this scenario. In this case the function should
> treat this as a case where rename is complete; i.e. catch the exception and
> if this is the cause exit gracefully with the result that the rename is
> complete
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)