avoid healObjects recursively healing at empty path (#11856)

baseDirFromPrefix(prefix) for object names without
parent directory incorrectly uses empty path, leading
to long listing at various paths that are not useful
for healing - avoid this listing completely if "baseDir"
returns empty simple use the "prefix" as is.

this improves startup performance significantly
This commit is contained in:
Harshavardhana 2021-03-23 07:57:07 -07:00 committed by GitHub
parent 922c7b57f5
commit da70e6ddf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1563,10 +1563,15 @@ func (z *erasureServerPools) HealObjects(ctx context.Context, bucket, prefix str
bucket: bucket,
}
path := baseDirFromPrefix(prefix)
if path == "" {
path = prefix
}
if err := listPathRaw(ctx, listPathRawOptions{
disks: disks,
bucket: bucket,
path: baseDirFromPrefix(prefix),
path: path,
recursive: true,
forwardTo: "",
minDisks: 1,