From 5d6f6d8d5bb6289dda2e7064d1ce1d872e1d85f2 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 7 Mar 2022 16:18:57 -0800 Subject: [PATCH] create missing .minio.sys/config, .minio.sys/buckets during decommission (#14497) --- cmd/erasure-server-pool-decom.go | 14 +++++++++++++- cmd/erasure-server-pool.go | 9 ++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/cmd/erasure-server-pool-decom.go b/cmd/erasure-server-pool-decom.go index 85697dd2c..bd44ebe79 100644 --- a/cmd/erasure-server-pool-decom.go +++ b/cmd/erasure-server-pool-decom.go @@ -593,7 +593,7 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool return } - // We need a reversed order for Decommissioning, + // We need a reversed order for decommissioning, // to create the appropriate stack. versionsSorter(fivs.Versions).reverse() @@ -955,6 +955,18 @@ func (z *erasureServerPools) StartDecommission(ctx context.Context, idx int) (er } } + // Create .minio.sys/conifg, .minio.sys/buckets paths if missing, + // this code is present to avoid any missing meta buckets on other + // pools. + for _, metaBucket := range []string{ + pathJoin(minioMetaBucket, minioConfigPrefix), + pathJoin(minioMetaBucket, bucketMetaPrefix), + } { + if err = z.MakeBucketWithLocation(ctx, metaBucket, BucketOptions{}); err != nil { + return err + } + } + // Buckets data are dispersed in multiple zones/sets, make // sure to decommission the necessary metadata. buckets = append(buckets, BucketInfo{ diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 97b5516a8..10dc094e7 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -661,6 +661,9 @@ func (z *erasureServerPools) MakeBucketWithLocation(ctx context.Context, bucket for index := range z.serverPools { index := index g.Go(func() error { + if z.IsSuspended(index) { + return nil + } return z.serverPools[index].MakeBucketWithLocation(ctx, bucket, opts) }, index) } @@ -672,7 +675,8 @@ func (z *erasureServerPools) MakeBucketWithLocation(ctx context.Context, bucket if _, ok := err.(BucketExists); !ok { // Delete created buckets, ignoring errors. z.DeleteBucket(context.Background(), bucket, DeleteBucketOptions{ - Force: false, NoRecreate: true, + Force: false, + NoRecreate: true, }) } return err @@ -1478,6 +1482,9 @@ func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, op for index := range z.serverPools { index := index g.Go(func() error { + if z.IsSuspended(index) { + return nil + } return z.serverPools[index].DeleteBucket(ctx, bucket, opts) }, index) }