You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Viraj Jasani (Jira)" <ji...@apache.org> on 2021/05/04 14:25:00 UTC

[jira] [Comment Edited] (HDFS-15982) Deleted data using HTTP API should be saved to the trash

    [ https://issues.apache.org/jira/browse/HDFS-15982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17338945#comment-17338945 ] 

Viraj Jasani edited comment on HDFS-15982 at 5/4/21, 2:24 PM:
--------------------------------------------------------------

Thanks for the questions [~ayushtkn]

All of below examples include positive value of fs.trash.interval config (to enable trash through core-site config).
{quote} * If my FileSystem is WebHdfs, If I call delete with recursive false on a non empty directory, will it delete now or throw me an exception? Should be a NO{quote}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz?op=DELETE&recursive=false"
{"boolean":true}
{code}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz?op=DELETE&recursive=false&skiptrash=true" {"RemoteException":{"exception":"PathIsNotEmptyDirectoryException","javaClassName":"org.apache.hadoop.fs.PathIsNotEmptyDirectoryException","message":"`/xyz is non empty': Directory is not empty"}}
{code}
recursive is used by fs.delete() only and not by fs.rename(), hence moving non-empty folder to trash just works fine. However, for skiptrash true case, we should just return \{"boolean":false} ?

 
{quote} * if my FileSystem is WebHdfs, If I call delete on a non-existing file, the response will be false? or Now an exception.{quote}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz1?op=DELETE&recursive=false"
{"RemoteException":{"exception":"FileNotFoundException","javaClassName":"java.io.FileNotFoundException","message":"File does not exist: /xyz1"}}
{code}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz1?op=DELETE&recursive=false&skiptrash=true" {"boolean":false}
{code}
Similarly here, for moving to trash case, we should return \{"boolean":false} ?
{quote} * How does this trash path resolution behaves when the client is coming through Router?{quote}
I think the resolution should be taken care of by FileSystem [here|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java#L1573-L1575].

For the above cases where Exceptions are being thrown instead of returning \{"boolean":false}, let me file a follow-up subtask soon once you confirm the expected behaviour [~ayushtkn].

Thanks


was (Author: vjasani):
Thanks for the questions [~ayushtkn]

All of below examples include positive value of fs.trash.interval config (to enable trash through core-site config).
{quote} * If my FileSystem is WebHdfs, If I call delete with recursive false on a non empty directory, will it delete now or throw me an exception? Should be a NO{quote}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz?op=DELETE&recursive=false"
{"boolean":true}
{code}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz?op=DELETE&recursive=false&skiptrash=true" {"RemoteException":{"exception":"PathIsNotEmptyDirectoryException","javaClassName":"org.apache.hadoop.fs.PathIsNotEmptyDirectoryException","message":"`/xyz is non empty': Directory is not empty"}}
{code}
I believe for skiptrash true case, we should just return \{"boolean":false} ?

 
{quote} * if my FileSystem is WebHdfs, If I call delete on a non-existing file, the response will be false? or Now an exception.{quote}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz1?op=DELETE&recursive=false"
{"RemoteException":{"exception":"FileNotFoundException","javaClassName":"java.io.FileNotFoundException","message":"File does not exist: /xyz1"}}
{code}
{code:java}
$ curl -X DELETE "http://localhost:9870/webhdfs/v1/xyz1?op=DELETE&recursive=false&skiptrash=true" {"boolean":false}
{code}
Similarly here, for moving to trash case, we should return \{"boolean":false} ?
{quote} * How does this trash path resolution behaves when the client is coming through Router?{quote}
I think the resolution should be taken care of by FileSystem [here|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java#L1573-L1575].

For the above cases where Exceptions are being thrown instead of returning \{"boolean":false}, let me file a follow-up subtask soon once you confirm the expected behaviour [~ayushtkn].

Thanks

> Deleted data using HTTP API should be saved to the trash
> --------------------------------------------------------
>
>                 Key: HDFS-15982
>                 URL: https://issues.apache.org/jira/browse/HDFS-15982
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>          Components: hdfs, hdfs-client, httpfs, webhdfs
>            Reporter: Bhavik Patel
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: Screenshot 2021-04-23 at 4.19.42 PM.png, Screenshot 2021-04-23 at 4.36.57 PM.png
>
>          Time Spent: 12h 10m
>  Remaining Estimate: 0h
>
> If we delete the data from the Web UI then it should be first moved to configured/default Trash directory and after the trash interval time, it should be removed. currently, data directly removed from the system[This behavior should be the same as CLI cmd]
> This can be helpful when the user accidentally deletes data from the Web UI.
> Similarly we should provide "Skip Trash" option in HTTP API as well which should be accessible through Web UI.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org