From da70e6ddf63cfcf6840c9f95e5ca2c0c93815fb9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 23 Mar 2021 07:57:07 -0700 Subject: [PATCH] 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 --- cmd/erasure-server-pool.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 9f7eeb1a1..72ba0a898 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -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,