neils-dev opened a new pull request #2110:
URL: https://github.com/apache/ozone/pull/2110
## What changes were proposed in this pull request?
To have FsShell _**rm**_ (eg. `bin/ozone fs -rm o3fs://bucket.volume/key`)
commands delete items from the filesystem Trash **_without_** need of the
_-skipTrash_ flag, changes are made to the ozone filesystem specific
TrashPolicy. Implemented through overriding the TrashPolicy _moveTrash_ method
for TrashPolicyOzone.
Here if the item to be deleted with the FsShell _**rm**_ command is located
in the key root trash directory, it is deleted from the filesystem. Before
this patch, items removed through the rm command were moved to the root Trash
directory when trash was enabled. Patch enacts similar behavior as that of
FsShell **_rm_** command with the -_skipTrash_ flag specified. Behavior with
the _-skipTrash_ flag enabled is unaffected.
Necessary for this patch is configuring the hadoop filesystem to use the
ozone implementation specific **_TrashPolicyOzone_** though the
'_core-site.xml_' as in :
`<property>
<name>fs.trash.classname</name>
<value>org.apache.hadoop.ozone.om.TrashPolicyOzone</value>
</property>`
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-4043
## How was this patch tested?
Patch was tested through both integration tests and manual tests.
**Integration test** implemented in ozone shell integration test :
TestOzoneShellHA.java. Tested through `hadoop-ozone/integration_test$ mvn
-Dtest=TestOzoneShellHA#testDeleteTrashNoSkipTrash test`
-------------------------------------------------------------------------------
Test set: org.apache.hadoop.ozone.shell.TestOzoneShellHA
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.099 s -
in org.apache.hadoop.ozone.shell.TestOzoneShellHA
**Manual test** through docker cluster deployment:
**before patch** ->
1. configure core-site.xml to use TrashPolicyDefault `<property>
<name>fs.trash.classname</name>
<value>org.apache.hadoop.ozone.om.TrashPolicyDefault</value>
</property>` OR leave unchanged (default behavior)
enable Trash
`<property>
<name>fs.trash.interval</name>
<value>60</value>
</property>`
2. run shell commands to create volume, bucket and key (eg.
/vol1/bucket1/key1)
3. run shell command to delete key (eg. `bin/ozone fs -rm -R
o3fs://bucket1.vol1/key1`)
4. run shell command to delete trash (eg. `bin/ozone fs -rm -R
o3fs://bucket1.vol1/.Trash`)
Trash directory remains.

**patch** ->
1. configure core-site.xml to use TrashPolicyOzone `<property>
<name>fs.trash.classname</name>
<value>org.apache.hadoop.ozone.om.TrashPolicyOzone</value>
</property>`
enable Trash
`<property>
<name>fs.trash.interval</name>
<value>60</value>
</property>`
2. run shell commands to create volume, bucket and key (eg.
/vol1/bucket1/key1)
3. run shell command to delete key (eg. `bin/ozone fs -rm -R
o3fs://bucket1.vol1/key1`)
4. run shell command to delete trash (eg. `bin/ozone fs -rm -R
o3fs://bucket1.vol1/.Trash`)
Trash directory **_is deleted_**.

--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]