[
https://issues.apache.org/jira/browse/HADOOP-16112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16863689#comment-16863689
]
He Xiaoqiao commented on HADOOP-16112:
--------------------------------------
[~jzhuge], Thanks for your comments.
{quote}the new unit test passes without any fix, is it valid? I understand race
condition is hard to reproduce.{quote}
right, new unit test actually does not verify anything, so in my opinion, it is
not a valid unit test.
I would like to state this case could be interpretable, may be not issue. IMO
it make sense for me no matter parent or child path add timestamp to mkdir, in
whatever way, I do not think we could guarantee consistency at the client side
through retry. Please correct me if something wrong.
> Delete the baseTrashPath's subDir leads to don't modify baseTrashPath
> ---------------------------------------------------------------------
>
> Key: HADOOP-16112
> URL: https://issues.apache.org/jira/browse/HADOOP-16112
> Project: Hadoop Common
> Issue Type: Bug
> Components: common
> Affects Versions: 3.2.0
> Reporter: Lisheng Sun
> Priority: Major
> Attachments: HADOOP-16112.001.patch, HADOOP-16112.002.patch
>
>
> There is race condition in TrashPolicyDefault#moveToTrash
> try {
> if (!fs.mkdirs(baseTrashPath, PERMISSION))
> { // create current LOG.warn("Can't create(mkdir) trash directory: " +
> baseTrashPath); return false; }
> } catch (FileAlreadyExistsException e) {
> // find the path which is not a directory, and modify baseTrashPath
> // & trashPath, then mkdirs
> Path existsFilePath = baseTrashPath;
> while (!fs.exists(existsFilePath))
> { existsFilePath = existsFilePath.getParent(); }
> {color:#ff0000}// case{color}
> {color:#ff0000} other thread deletes existsFilePath here ,the results
> doesn't meet expectation{color}
> {color:#ff0000} for example{color}
> {color:#ff0000} there is
> /user/u_sunlisheng/.Trash/Current/user/u_sunlisheng/b{color}
> {color:#ff0000} when delete /user/u_sunlisheng/b/a. if existsFilePath is
> deleted, the result is
> /user/u_sunlisheng/.Trash/Current/user/u_sunlisheng+timstamp/b/a{color}
> {color:#ff0000} so when existsFilePath is deleted, don't modify
> baseTrashPath. {color}
> baseTrashPath = new Path(baseTrashPath.toString().replace(
> existsFilePath.toString(), existsFilePath.toString() + Time.now())
> );
> trashPath = new Path(baseTrashPath, trashPath.getName());
> // retry, ignore current failure
> --i;
> continue;
> } catch (IOException e)
> { LOG.warn("Can't create trash directory: " + baseTrashPath, e); cause = e;
> break; }
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]