rakeshadr commented on a change in pull request #3175:
URL: https://github.com/apache/ozone/pull/3175#discussion_r837060010
##########
File path:
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java
##########
@@ -468,6 +468,49 @@ boolean processKeyPath(List<String> keyPathList) {
}
}
+ /**
+ * To be used only by recursiveBucketDelete().
+ */
+ private class DeleteIteratorWithFSO extends OzoneListingIterator {
+ private final OzoneBucket bucket;
+ private final BasicRootedOzoneClientAdapterImpl adapterImpl;
+ private boolean recursive;
+ private Path f;
+ DeleteIteratorWithFSO(Path f, boolean recursive)
+ throws IOException {
+ super(f, true);
+ this.f = f;
+ this.recursive = recursive;
+ // Initialize bucket here to reduce number of RPC calls
+ OFSPath ofsPath = new OFSPath(f);
+ adapterImpl = (BasicRootedOzoneClientAdapterImpl) adapter;
+ this.bucket = adapterImpl.getBucket(ofsPath, false);
+ }
+
+ @Override
+ boolean processKeyPath(List<String> keyPathList) throws IOException {
+ LOG.trace("Deleting keys: {}", keyPathList);
+ boolean succeed = keyPathList.isEmpty();
+ if (recursive) {
+ for (String key : keyPathList) {
+ // if key is a directory
+ if (key.endsWith(OZONE_URI_DELIMITER)) {
Review comment:
@sadanand48 Do we need this additional trailing slash logic everywhere
in the client code. Since OM server side code ,
[OMKeyDeleteRequestWithFSO#L133](https://github.com/apache/ozone/blob/ebbe9b581542af0cdc0c813996d498678cc78114/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyDeleteRequestWithFSO.java#L133)
already has a check for a directory/file status and act upon.
How about like, simple iterate over all the immediate children
nodes(irrespective of dir or file) and send an RPC call to the OM server like:
```
foreach(key : childListStatus){
adapterImpl.deleteObject(key, true);
}
```
Also, we can further optimize the client side logic by sending the immediate
path statuses as a batch of keyPaths to a `new OMKeysDeleteRequestWithFSO`
class, which inturn can have a new implementation of iterating over the list of
dirs/files and act upon?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]