[
https://issues.apache.org/jira/browse/HADOOP-19801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18063817#comment-18063817
]
ASF GitHub Bot commented on HADOOP-19801:
-----------------------------------------
deepujain opened a new pull request, #8306:
URL: https://github.com/apache/hadoop/pull/8306
### Summary
Adds option `fs.s3a.delete.non-empty-directory.enabled`. When true,
recursive delete of a non-empty directory sends a single delete request for the
directory key (prefix) instead of listing and bulk-deleting contained objects.
Only enable for S3-compatible endpoints that support deleting a non-empty
directory in one request (e.g.
[VAST](https://kb.vastdata.com/documentation/docs/using-trash-folder-for-s3-objects-6)).
### Change
- **Constants.java**: New config key `DELETE_NON_EMPTY_DIRECTORY_ENABLED`
(`fs.s3a.delete.non-empty-directory.enabled`), default `false`.
- **InternalConstants.java**: Added to `S3A_DYNAMIC_CAPABILITIES` for path
capability probing.
- **S3AFileSystem.java**: Read option in `initialize()`, pass to
`DeleteOperation`, expose via
`hasPathCapability(DELETE_NON_EMPTY_DIRECTORY_ENABLED)`.
- **DeleteOperation.java**: New constructor parameter
`deleteNonEmptyDirectoryEnabled`. When true and directory is non-empty, call
`deleteObjectAtPath(path, key, false)` once instead of
`deleteDirectoryTree(path, key)`.
### JIRA
Fixes HADOOP-19801
> Allow to skip recursive file deletion for non-empty directory
> -------------------------------------------------------------
>
> Key: HADOOP-19801
> URL: https://issues.apache.org/jira/browse/HADOOP-19801
> Project: Hadoop Common
> Issue Type: New Feature
> Components: hadoop-aws
> Reporter: Enrico Minack
> Priority: Major
>
> A non-empty directory, as well as a directory where its emptiness is unknown,
> is deleted by listing all contained files (or objects with matching key
> prefix), then deleting those files (objects) in bulk delete requests, and
> finally deleting the (then) empty directory itself.
> The recursive deletion of objects is not needed for S3 endpoints that support
> deleting non-empty directories (or path prefixes).
> For example: The [VAST S3 endpoint supports deleting non-empty
> directories|https://kb.vastdata.com/documentation/docs/using-trash-folder-for-s3-objects-6]
> with a single request. Such a feature can only be fully leveraged if
> {{hadoop-aws}} coupd skip the recursive deletion.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]