[
https://issues.apache.org/jira/browse/HDDS-7884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17684018#comment-17684018
]
Siyao Meng commented on HDDS-7884:
----------------------------------
Here is a draft of the patch that should hopefully fix the issue:
{code:diff|title=v1}
diff --git
a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
index c1d882b2e4..20e9f58f81 100644
---
a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
+++
b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
@@ -538,7 +538,17 @@ public boolean deleteObject(String path, boolean recursive)
}
try {
OzoneBucket bucket = getBucket(ofsPath, false);
- bucket.deleteDirectory(keyName, recursive);
+ if (bucket.isLink()) {
+ final String bucketName = bucket.getName();
+ final String volumeName = bucket.getVolumeName();
+ LOG.debug("removing linked bucket '{}' from volume '{}'",
+ bucketName, volumeName);
+ // Delete the bucket from volume
+ OzoneVolume vol = objectStore.getVolume(volumeName);
+ vol.deleteBucket(bucketName);
+ } else {
+ bucket.deleteDirectory(keyName, recursive);
+ }
return true;
} catch (OMException ome) {
LOG.error("delete key failed {}", ome.getMessage());
{code}
> ofs: Recursive delete of path of symlink with empty source fails
> ----------------------------------------------------------------
>
> Key: HDDS-7884
> URL: https://issues.apache.org/jira/browse/HDDS-7884
> Project: Apache Ozone
> Issue Type: Bug
> Reporter: Neil Joshi
> Priority: Major
>
> There exists a bug in ofs for the recursive delete of paths with symlinks
> that have empty src bucket.
> Symlinks with empty source src occurs when the src bucket is deleted prior to
> the linked bucket. In this case when recursively deleting a path in ofs with
> a symlink in this state fails with error message in shell, *_Directory is
> not empty_* and underlying exception: VOLUME_NOT_EMPTY
> org.apache.hadoop.ozone.om.exceptions.OMException.\
>
> Problem can be reproduced with dev docker cluster:
>
> {code:java}
> bash-4.2$ ozone sh volume create /vol1
> bash-4.2$ ozone sh bucket create /vol1/bucket1
> bash-4.2$ ozone sh volume create /linkvol
> # link src bucket to target linkvol
> bash-4.2$ ozone sh bucket link /vol1/bucket1 /linkvol/bucket1
> # delete src volume and bucket
> bash-4.2$ ozone fs -rm -R -f -skipTrash ofs://om/vol1
> # recursively delete linked volume and contents
> bash-4.2$ ozone fs -rm -R -f -skipTrash ofs://om/linkvol
> rm: `ofs://om/linkvol': Directory is not empty
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]