[
https://issues.apache.org/jira/browse/HDFS-15982?focusedWorklogId=592577&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-592577
]
ASF GitHub Bot logged work on HDFS-15982:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 04/May/21 06:54
Start Date: 04/May/21 06:54
Worklog Time Spent: 10m
Work Description: virajjasani commented on a change in pull request #2927:
URL: https://github.com/apache/hadoop/pull/2927#discussion_r625546392
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
##########
@@ -1527,34 +1535,53 @@ public Response delete(
@QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
final RecursiveParam recursive,
@QueryParam(SnapshotNameParam.NAME)
@DefaultValue(SnapshotNameParam.DEFAULT)
- final SnapshotNameParam snapshotName
+ final SnapshotNameParam snapshotName,
+ @QueryParam(DeleteSkipTrashParam.NAME)
+ @DefaultValue(DeleteSkipTrashParam.DEFAULT)
+ final DeleteSkipTrashParam skiptrash
) throws IOException, InterruptedException {
- init(ugi, delegation, username, doAsUser, path, op, recursive,
snapshotName);
+ init(ugi, delegation, username, doAsUser, path, op, recursive,
+ snapshotName, skiptrash);
- return doAs(ugi, new PrivilegedExceptionAction<Response>() {
- @Override
- public Response run() throws IOException {
- return delete(ugi, delegation, username, doAsUser,
- path.getAbsolutePath(), op, recursive, snapshotName);
- }
- });
+ return doAs(ugi, () -> delete(
+ path.getAbsolutePath(), op, recursive, snapshotName, skiptrash));
}
protected Response delete(
- final UserGroupInformation ugi,
- final DelegationParam delegation,
- final UserParam username,
- final DoAsParam doAsUser,
final String fullpath,
final DeleteOpParam op,
final RecursiveParam recursive,
- final SnapshotNameParam snapshotName
- ) throws IOException {
+ final SnapshotNameParam snapshotName,
+ final DeleteSkipTrashParam skipTrash) throws IOException {
final ClientProtocol cp = getRpcClientProtocol();
switch(op.getValue()) {
case DELETE: {
+ Configuration conf =
+ (Configuration) context.getAttribute(JspHelper.CURRENT_CONF);
+ long trashInterval =
+ conf.getLong(FS_TRASH_INTERVAL_KEY, FS_TRASH_INTERVAL_DEFAULT);
+ if (trashInterval > 0 && !skipTrash.getValue()) {
+ LOG.info("{} is {} , trying to archive {} instead of removing",
+ FS_TRASH_INTERVAL_KEY, trashInterval, fullpath);
+ org.apache.hadoop.fs.Path path =
+ new org.apache.hadoop.fs.Path(fullpath);
+ Configuration clonedConf = new Configuration(conf);
+ // To avoid caching FS objects and prevent OOM issues
+ clonedConf.set("fs.hdfs.impl.disable.cache", "true");
+ FileSystem fs = FileSystem.get(clonedConf);
+ boolean movedToTrash = Trash.moveToAppropriateTrash(fs, path,
+ clonedConf);
Review comment:
This is where I have tried to address @jojochuang's concerns reg how we
can avoid causing OOM (not caching new FileSystem objects)
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 592577)
Time Spent: 11h 40m (was: 11.5h)
> 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: 11h 40m
> 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: [email protected]
For additional commands, e-mail: [email protected]