From ccc5801112c3ef9d69972967c712844f4659f44c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 21 Jun 2023 08:49:28 -0700 Subject: [PATCH] always look for expired versions v/s remaining versions (#17479) while decommissioning it can so happen that the non-current versions are all expired but there is a DEL marker as the latest version. For such objects, we should not decommission them instead calculate the remaining versions and if the remaining versions is one and that version is a DEL marker consider such an object not to be scheduled for decommissioning. --- cmd/erasure-server-pool-decom.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/erasure-server-pool-decom.go b/cmd/erasure-server-pool-decom.go index 1e74f4cb8..7da089ad4 100644 --- a/cmd/erasure-server-pool-decom.go +++ b/cmd/erasure-server-pool-decom.go @@ -419,7 +419,9 @@ func (p poolMeta) save(ctx context.Context, pools []*erasureSets) error { // Saves on all pools to make sure decommissioning of first pool is allowed. for i, eset := range pools { if err = saveConfig(ctx, eset, poolMetaName, buf); err != nil { - logger.LogIf(ctx, fmt.Errorf("saving pool.bin for pool index %d failed with: %v", i, err)) + if !errors.Is(err, context.Canceled) { + logger.LogIf(ctx, fmt.Errorf("saving pool.bin for pool index %d failed with: %v", i, err)) + } return err } } @@ -729,8 +731,10 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool } // any object with only single DEL marker we don't need - // to decommission, just skip it. - if version.Deleted && len(fivs.Versions) == 1 { + // to decommission, just skip it, this also includes + // any other versions that have already expired. + remainingVersions := len(fivs.Versions) - decommissionedCount + if version.Deleted && remainingVersions == 1 { decommissionedCount++ continue }