[ https://issues.apache.org/jira/browse/HDFS-15982?focusedWorklogId=590892&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-590892 ]
ASF GitHub Bot logged work on HDFS-15982: ----------------------------------------- Author: ASF GitHub Bot Created on: 29/Apr/21 08:51 Start Date: 29/Apr/21 08:51 Worklog Time Spent: 10m Work Description: virajjasani commented on a change in pull request #2927: URL: https://github.com/apache/hadoop/pull/2927#discussion_r622855584 ########## File path: hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java ########## @@ -743,6 +748,15 @@ public FSDelete(String path, boolean recursive) { */ @Override public JSONObject execute(FileSystem fs) throws IOException { + if (!skipTrash) { + boolean movedToTrash = Trash.moveToAppropriateTrash(fs, path, + fs.getConf()); + if (movedToTrash) { + HttpFSServerWebApp.getMetrics().incrOpsDelete(); + return toJSON( + StringUtils.toLowerCase(HttpFSFileSystem.DELETE_JSON), true); + } Review comment: Sure thing. I put comment on `NamenodeWebHdfsMethods` but somehow missed here. ########## File path: hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/resources/DeleteSkipTrashParam.java ########## @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hdfs.web.resources; + +/** + * SkipTrash param to be used by DELETE query. + */ +public class DeleteSkipTrashParam extends BooleanParam { + + public static final String NAME = "skiptrash"; + public static final String DEFAULT = FALSE; Review comment: Thanks for the suggestion. In fact, there was similar discussion on Jira as well and it seems so far the consensus was to keep it `false` by default. Because of which, this will be incompatible change w.r.t default behaviour of DELETE API. Hence, the decision was to mark Jira Incompatible change and we can still go ahead with this new behaviour starting 3.3.1/3.4.0 release. However, I am fine changing this to `true` as well if that's where majority would like to go with. FYI @jojochuang -- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 590892) Time Spent: 5.5h (was: 5h 20m) > 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, 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: 5.5h > 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-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org