Details
-
Bug
-
Status: Patch Available
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
there is race condition in method moveToTrash class TrashPolicyDefault
try {
if (!fs.mkdirs(baseTrashPath, PERMISSION))
} catch (FileAlreadyExistsException e) {
// find the path which is not a directory, and modify baseTrashPath
// & trashPath, then mkdirs
Path existsFilePath = baseTrashPath;
while (!fs.exists(existsFilePath))
// case
other thread deletes existsFilePath here ,the results doesn't meet expectation
for example
there is /user/u_sunlisheng/.Trash/Current/user/u_sunlisheng/b
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
so when existsFilePath is deleted, don't modify baseTrashPath.
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)
Attachments
Attachments
Issue Links
- Blocked
-
HADOOP-15633 fs.TrashPolicyDefault: Can't create trash directory
- Resolved