ChenSammi commented on code in PR #11815:
URL: https://github.com/apache/ozone/pull/11815#discussion_r4411253968
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -1650,6 +1650,14 @@ private void checkAndCreateTrashDirIfNeeded(OmBucketInfo
bucket, Path dirPath) t
if (e instanceof OMException &&
(((OMException) e).getResult() ==
OMException.ResultCodes.FILE_NOT_FOUND ||
((OMException) e).getResult() ==
OMException.ResultCodes.DIRECTORY_NOT_FOUND)) {
+ // The bucket may have been deleted and recreated since the task
checked it, do not create
Review Comment:
This get and set will reduce the time window that the edge case can happen,
but not totally remove the chance, unless we carry the bucket ID to
CreateDirectoryRequest.
And I think it's a general case for Ozone, that if a bucket is deleted and
recreated, the new key/directory creation will be operated on the new bucket,
whether it will succeed or not depends on whether the permission check is
passed.
For this specific case, I would propose "not to fix", since the
CreateDirectoryRequest might fail on the new bucket for no permission, even
permission check is passed, there is no obvious harm to create a Trash
directory under the new bucket, and the key move after that will definitely
fail, because a bucket can only be deleted when it's empty, so no key to move.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]