[
https://issues.apache.org/jira/browse/HDDS-9610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17783675#comment-17783675
]
Sadanand Shenoy commented on HDDS-9610:
---------------------------------------
I think it is done that way because legacy incomplete deletes can cause
inconsistent state.
Lets say delete dir1 that contains file1 , file2
In Legacy it will list and create 3 keys to delete = \{dir1, dir1/file1,
dir1/file2}
after deleting dir1 there is a failure, but delete returns successNext time we
again try to delete dir1 but as a first step we do getFileStatus(dir1) which
will return KEY_NOT_FOUND and delete willl abort keeping 2 orphan keys in
KeyTable.
This is the problem with legacy non atomic deletes which FSO solves. One of
the motivations for the FSO feature was to solve these issues by moving away
from legacy.
> Recursive fs delete on a Legacy bucket succeeds even if no keys were deleted
> ----------------------------------------------------------------------------
>
> Key: HDDS-9610
> URL: https://issues.apache.org/jira/browse/HDDS-9610
> Project: Apache Ozone
> Issue Type: Bug
> Components: OFS, Ozone CLI
> Reporter: Christos Bisias
> Assignee: Aryan Gupta
> Priority: Major
>
> For a Legacy bucket, recursive delete might appear successful even if no keys
> were actually deleted.
> The issue can be reproduced in the docker dev env. Edit *docker-config* to
> enable native ACLs
> {noformat}
> OZONE-SITE.XML_ozone.acl.enabled=true
> OZONE-SITE.XML_ozone.acl.authorizer.class=org.apache.hadoop.ozone.security.acl.OzoneNativeAuthorizer{noformat}
> Start the docker env and run the commands below
> {code:java}
> > docker-compose exec -T om ozone sh volume create /vol1
> > docker-compose exec -T om ozone sh bucket create /vol1/bucket1 -l LEGACY
> > docker-compose exec -T om ozone sh volume setacl -a
> > user:testuser2:rw,user:testuser:a,group:testuser2:rw,group:testuser:a vol1
> ACLs set successfully.
> > docker-compose exec -T om ozone sh bucket setacl -a
> > user:testuser2:rwlc,user:testuser:a,group:testuser2:rwlc,group:testuser:a
> > vol1/bucket1
> ACLs set successfully.
> > docker-compose exec -T -u testuser om ozone fs -mkdir /vol1/bucket1/dir1
> > docker-compose exec -T -u testuser om ozone fs -put ./README.md
> > /vol1/bucket1/dir1/readme
> > docker-compose exec -T -u testuser2 om ozone fs -rm -r -skipTrash
> > /vol1/bucket1/dir1
> Deleted /vol1/bucket1/dir1
> > docker-compose exec -T -u testuser om ozone fs -ls /vol1/bucket1/dir1
> Found 1 items
> -rw-rw-rw- 3 testuser testuser 4068 2023-11-02 16:53
> /vol1/bucket1/dir1/readme {code}
> This is happening because in
> *BasicRootedOzoneFileSystem* we are processing keys one by one and if there
> is a recursive flag, we ignore whether the key was deleted or not, just to
> continue with processing the next iteration. The result should be a success
> only if all keys were successfully deleted.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]