mirror of
https://github.com/minio/minio.git
synced 2025-11-21 10:16:03 -05:00
heal: Remove empty directories (#11354)
Since the introduction of __XLDIR__, an empty directory does not have a meaning anymore in erasure mode. Make healing removes it wherever it finds it.
This commit is contained in:
@@ -786,6 +786,31 @@ func (er erasureObjects) deleteObjectVersion(ctx context.Context, bucket, object
|
||||
return reduceWriteQuorumErrs(ctx, g.Wait(), objectOpIgnoredErrs, writeQuorum)
|
||||
}
|
||||
|
||||
// deleteEmptyDir knows only how to remove an empty directory (not the empty object with a
|
||||
// trailing slash), this is called for the healing code to remove such directories.
|
||||
func (er erasureObjects) deleteEmptyDir(ctx context.Context, bucket, object string) error {
|
||||
defer ObjectPathUpdated(pathJoin(bucket, object))
|
||||
|
||||
if bucket == minioMetaTmpBucket {
|
||||
return nil
|
||||
}
|
||||
|
||||
disks := er.getDisks()
|
||||
g := errgroup.WithNErrs(len(disks))
|
||||
for index := range disks {
|
||||
index := index
|
||||
g.Go(func() error {
|
||||
if disks[index] == nil {
|
||||
return errDiskNotFound
|
||||
}
|
||||
return disks[index].Delete(ctx, bucket, object, false)
|
||||
}, index)
|
||||
}
|
||||
|
||||
// return errors if any during deletion
|
||||
return reduceWriteQuorumErrs(ctx, g.Wait(), objectOpIgnoredErrs, len(disks)/2+1)
|
||||
}
|
||||
|
||||
// deleteObject - wrapper for delete object, deletes an object from
|
||||
// all the disks in parallel, including `xl.meta` associated with the
|
||||
// object.
|
||||
|
||||
Reference in New Issue
Block a user