adoroszlai commented on code in PR #6991:
URL: https://github.com/apache/ozone/pull/6991#discussion_r1693859283
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -766,15 +765,15 @@ private boolean deleteInSpan(Path f, boolean recursive)
throws IOException {
return result;
}
- private boolean deleteBucket(Path f, boolean recursive, OFSPath ofsPath)
+ private boolean deleteBucket(Path f, boolean recursive, OzoneBucket bucket)
throws IOException {
Review Comment:
```suggestion
private boolean deleteBucket(Path f, boolean recursive, OFSPath ofsPath)
throws IOException {
OzoneBucket bucket;
try {
bucket = adapterImpl.getBucket(ofsPath, false);
} catch (Exception ex) {
return false;
}
```
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -727,7 +728,7 @@ private boolean deleteInSpan(Path f, boolean recursive)
throws IOException {
// delete bucket
if (ofsPath.isBucket()) {
- return deleteBucket(f, recursive, ofsPath);
+ return deleteBucket(f, recursive, bucket);
Review Comment:
```suggestion
return deleteBucket(f, recursive, ofsPath);
```
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -799,14 +798,13 @@ private boolean deleteBucket(Path f, boolean recursive,
OFSPath ofsPath)
// if so, the contents of bucket were deleted and skip delete bucket
// otherwise, Handle delete bucket
if (!handleTrailingSlash) {
- deleteBucketFromVolume(f, ofsPath);
+ deleteBucketFromVolume(f, bucket);
}
return result;
}
- private boolean isLinkBucket(Path f, OFSPath ofsPath) {
+ private boolean isLinkBucket(Path f, OzoneBucket bucket) {
try {
Review Comment:
Exception handling is no longer needed. With that, this method can be
inlined (`bucket.isLink()` used directly).
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -704,6 +704,7 @@ private boolean deleteInSpan(Path f, boolean recursive)
throws IOException {
String key = pathToKey(f);
OFSPath ofsPath = new OFSPath(key,
ozoneConfiguration);
+ OzoneBucket bucket = adapterImpl.getBucket(ofsPath, false);
Review Comment:
I think `getBucket` should be moved into `deleteBucket`.
```suggestion
```
--
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]