From e9d970154dd2327aa958648cb43e43eb8aa504e9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 19 Aug 2021 09:16:14 -0700 Subject: [PATCH] use renameAll instead of deleteAll for metacache-manager (#13005) renameAll is cheaper, rely on background deletes instead. --- cmd/erasure-multipart.go | 2 +- cmd/erasure-server-pool.go | 14 +------------- cmd/metacache.go | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/cmd/erasure-multipart.go b/cmd/erasure-multipart.go index cbde0e850..e591e1997 100644 --- a/cmd/erasure-multipart.go +++ b/cmd/erasure-multipart.go @@ -122,7 +122,7 @@ func (er erasureObjects) renameAll(ctx context.Context, bucket, prefix string) { wg.Add(1) go func(disk StorageAPI) { defer wg.Done() - disk.RenameFile(ctx, bucket, prefix, minioMetaTmpBucket, mustGetUUID()) + disk.RenameFile(ctx, bucket, prefix, minioMetaTmpDeletedBucket, mustGetUUID()) }(disk) } wg.Wait() diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 1c4cddad1..647b9e7d1 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -1421,20 +1421,8 @@ func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, fo return nil } -// deleteAll will delete a bucket+prefix unconditionally across all disks. -// Note that set distribution is ignored so it should only be used in cases where -// data is not distributed across sets. -// Errors are logged but individual disk failures are not returned. -func (z *erasureServerPools) deleteAll(ctx context.Context, bucket, prefix string) { - for _, servers := range z.serverPools { - for _, set := range servers.sets { - set.deleteAll(ctx, bucket, prefix) - } - } -} - // renameAll will rename bucket+prefix unconditionally across all disks to -// minioMetaTmpBucket + unique uuid, +// minioMetaTmpDeletedBucket + unique uuid, // Note that set distribution is ignored so it should only be used in cases where // data is not distributed across sets. Errors are logged but individual // disk failures are not returned. diff --git a/cmd/metacache.go b/cmd/metacache.go index 9c3a39cef..384f40073 100644 --- a/cmd/metacache.go +++ b/cmd/metacache.go @@ -149,5 +149,5 @@ func (m *metacache) delete(ctx context.Context) { logger.LogIf(ctx, errors.New("metacache.delete: expected objAPI to be *erasureServerPools")) return } - ez.deleteAll(ctx, minioMetaBucket, metacachePrefixForID(m.bucket, m.id)) + ez.renameAll(ctx, minioMetaBucket, metacachePrefixForID(m.bucket, m.id)) }