From 97d952e61cd603b4d8f2980f4250a390e1a32ffa Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 27 Apr 2020 14:18:02 -0700 Subject: [PATCH] fix: ensure buckets are preserved if one set returns error (#9468) the bucket should be deleted if it can be successfully deleted on all sets, if not we should ensure to restore those buckets properly. --- cmd/xl-sets.go | 15 ++++++--------- cmd/xl-zones.go | 6 ++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/cmd/xl-sets.go b/cmd/xl-sets.go index d66e83342..257679ab4 100644 --- a/cmd/xl-sets.go +++ b/cmd/xl-sets.go @@ -514,12 +514,11 @@ func (s *xlSets) MakeBucketWithLocation(ctx context.Context, bucket, location st } errs := g.Wait() - // Upon even a single write quorum error we undo all previously created buckets. + // Upon any error we try to undo the make bucket operation if possible + // on all sets where it succeeded. for _, err := range errs { if err != nil { - if _, ok := err.(InsufficientWriteQuorum); ok { - undoMakeBucketSets(bucket, s.sets, errs) - } + undoMakeBucketSets(bucket, s.sets, errs) return err } } @@ -686,13 +685,11 @@ func (s *xlSets) DeleteBucket(ctx context.Context, bucket string, forceDelete bo } errs := g.Wait() - // For any write quorum failure, we undo all the delete buckets operation - // by creating all the buckets again. + // For any failure, we attempt undo all the delete buckets operation + // by creating buckets again on all sets which were successfully deleted. for _, err := range errs { if err != nil { - if _, ok := err.(InsufficientWriteQuorum); ok { - undoDeleteBucketSets(bucket, s.sets, errs) - } + undoDeleteBucketSets(bucket, s.sets, errs) return err } } diff --git a/cmd/xl-zones.go b/cmd/xl-zones.go index 5c54df54d..30f964303 100644 --- a/cmd/xl-zones.go +++ b/cmd/xl-zones.go @@ -87,11 +87,9 @@ func newXLZones(ctx context.Context, endpointZones EndpointZones) (ObjectLayer, return nil, err } } - if !z.SingleZone() { - z.quickHealBuckets(ctx) - } - go intDataUpdateTracker.start(GlobalContext, localDrives...) + z.quickHealBuckets(ctx) + go intDataUpdateTracker.start(GlobalContext, localDrives...) return z, nil }