rakeshadr commented on code in PR #3175:
URL: https://github.com/apache/ozone/pull/3175#discussion_r841389614
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -567,7 +626,12 @@ public boolean delete(Path f, boolean recursive) throws
IOException {
}
}
- result = innerDelete(f, recursive);
+ if (ofsPath.isBucket() && isFSObucket(ofsPath.getVolumeName(),
+ ofsPath.getBucketName())) {
+ result = recursiveBucketDelete(f, recursive);
Review Comment:
@sadanand48 Thanks for the updated patch.
Can we do the iterator creation using `DeleteIteratorFactory` something
like below:
`private class DeleteIteratorWithFSO extends DeleteIterator {`
```
private class DeleteIteratorFactory {
Path path;
boolean recursive;
OFSPath ofsPath;
DeleteIteratorFactory(Path f, boolean recursive,
OFSPath ofsPath) {
path = f;
recursive = recursive;
ofsPath = ofsPath;
}
DeleteIterator getDeleteIterator()
throws IOException {
DeleteIterator deleteIterator;
if (ofsPath.isBucket() &&
isFSObucket(ofsPath.getVolumeName(), ofsPath.getBucketName())) {
deleteIterator = new DeleteIteratorWithFSO(path, recursive);
} else {
deleteIterator = new DeleteIterator(path, recursive);
}
return deleteIterator;
}
}
```
```
private boolean innerDelete(Path f, boolean recursive, OFSPath ofsPath)
throws IOException {
LOG.trace("delete() path:{} recursive:{}", f, recursive);
try {
DeleteIterator iterator =
new DeleteIteratorFactory(f, recursive,
ofsPath).getDeleteIterator();
return iterator.iterate();
} catch (FileNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Couldn't delete {} - does not exist", f);
}
return false;
}
}
```
--
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]