neils-dev opened a new pull request #2458: URL: https://github.com/apache/ozone/pull/2458
…rive delete of bucket invoked with Trash enabled. ## What changes were proposed in this pull request? When the trash service is enabled and a _bucket_ recursive delete, `rm -r`, ozone fs command is invoked a fatal error occurs ( _**Fatal internal error**_ for _ofs_ and _**Null Pointer Exception**_ for _o3fs_). This patch fixes the fatal error condition for handling the ozone fs shell `rm -r` command for buckets through the ozone trash policy specific _moveToTrash_ method. When the recursive rm is invoked with trash enabled, the trash policy _moveToTrash_ method is called to provide placing the item (through rename) to the bucket specific trash. Because the the bucket is recursively deleted along with all keys in this case, the Trash directory (found under the bucket) is also affected causing the fatal error. This patch detects the error condition and handles the condition by throwing an informative error and directs the user to apply _**-skipTrash**_ option to override and perform the delete. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-5175 ## How was this patch tested? Patch was tested invoking ozone fs shell commands with trash service enabled on the docker ozonesecure cluster. ``` $ cd hadoop-ozone/dist/target/ozone-1.2.0-SNAPSHOT/compose/ozonesecure $ docker-compose up -d --scale datanode=3 $ docker-compose exec scm bash ``` ``` bash-4.2$ kinit -kt /etc/security/keytabs/testuser.keytab testuser/[email protected] bash-4.2$ ozone sh volume create vol1 bash-4.2$ ozone fs -mkdir -p /vol1/bucket1 bash-4.2$ ozone fs -touch /vol1/bucket1/key1 ``` To create error: ofs: `bash-4.2$ ozone fs -rm -R /vol1/bucket1` o3fs: `ozone fs -rm -R o3fs://bucket1.vol1` **_Apply patch through core-site configuration: using ozone specific trash policy:_** set **`_<property> <name>fs.trash.classname</name><value>org.apache.hadoop.ozone.om.TrashPolicyOzone</value> </property>`_** set `fs.trash.classname=org.apache.hadoop.ozone.om.TrashPolicyOzone ` `bash-4.2$ vi /etc/hadoop/core-site.xml` insert `<property> <name>fs.trash.classname</name><value>org.apache.hadoop.ozone.om.TrashPolicyOzone</value> </property>` _ofs fix:_  _o3fs fix:_  override and delete with `-skipTrash` option:  -- 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]
