From af8f563ed39f36a86558af808db34faa76af7f52 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 17 Feb 2022 12:49:46 -0800 Subject: [PATCH] allow clearing FIFO config as fallback (#14338) FIFO is already removed, for users who upgrade are allowed to clear their configs. --- cmd/admin-bucket-handlers.go | 5 +++++ cmd/bucket-quota.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/cmd/admin-bucket-handlers.go b/cmd/admin-bucket-handlers.go index fcf3c6cc6..ac175541a 100644 --- a/cmd/admin-bucket-handlers.go +++ b/cmd/admin-bucket-handlers.go @@ -71,6 +71,11 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r * return } + if quotaConfig.Type == "fifo" { + writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrInvalidRequest), r.URL) + return + } + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, data); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return diff --git a/cmd/bucket-quota.go b/cmd/bucket-quota.go index 59dc5c1c8..5c03f5f5d 100644 --- a/cmd/bucket-quota.go +++ b/cmd/bucket-quota.go @@ -20,10 +20,12 @@ package cmd import ( "context" "encoding/json" + "errors" "fmt" "time" "github.com/minio/madmin-go" + "github.com/minio/minio/internal/logger" ) // BucketQuotaSys - map of bucket and quota configuration. @@ -85,6 +87,10 @@ func parseBucketQuota(bucket string, data []byte) (quotaCfg *madmin.BucketQuota, return quotaCfg, err } if !quotaCfg.IsValid() { + if quotaCfg.Type == "fifo" { + logger.LogIf(GlobalContext, errors.New("Detected older 'fifo' quota config, 'fifo' feature is removed and not supported anymore. Please clear your quota configs using 'mc admin bucket quota alias/bucket --clear' and use 'mc ilm add' for expiration of objects")) + return quotaCfg, nil + } return quotaCfg, fmt.Errorf("Invalid quota config %#v", quotaCfg) } return