fix: decommission delete markers for non-current objects (#15225)

versioned buckets were not creating the delete markers
present in the versioned stack of an object, this essentially
would stop decommission to succeed.

This PR fixes creating such delete markers properly during
a decommissioning process, adds tests as well.
This commit is contained in:
Harshavardhana
2022-07-05 07:37:24 -07:00
committed by GitHub
parent 39b3941892
commit 9d80ff5a05
3 changed files with 26 additions and 9 deletions

View File

@@ -689,6 +689,7 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
VersionID: version.VersionID,
MTime: version.ModTime,
DeleteReplication: version.ReplicationState,
DeleteMarker: true, // make sure we create a delete marker
})
var failure bool
if err != nil {
@@ -698,10 +699,10 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
z.poolMetaMutex.Lock()
z.poolMeta.CountItem(idx, 0, failure)
z.poolMetaMutex.Unlock()
if failure {
break // break out on first error
if !failure {
// Success keep a count.
decommissionedCount++
}
decommissionedCount++
continue
}