decom: Ignore object/version error during deletion (#15806)

This commit is contained in:
Anis Elleuch 2022-10-06 17:41:58 +01:00 committed by GitHub
parent 78385bfbeb
commit 158d0e26a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -768,6 +768,10 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
DeleteMarker: true, // make sure we create a delete marker DeleteMarker: true, // make sure we create a delete marker
SkipDecommissioned: true, // make sure we skip the decommissioned pool SkipDecommissioned: true, // make sure we skip the decommissioned pool
}) })
if isErrObjectNotFound(err) || isErrVersionNotFound(err) {
// object/version already deleted by the application, nothing to do here we move on.
continue
}
var failure bool var failure bool
if err != nil { if err != nil {
logger.LogIf(ctx, err) logger.LogIf(ctx, err)
@ -783,7 +787,7 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
continue continue
} }
var failure bool var failure, ignore bool
// gr.Close() is ensured by decommissionObject(). // gr.Close() is ensured by decommissionObject().
for try := 0; try < 3; try++ { for try := 0; try < 3; try++ {
gr, err := set.GetObjectNInfo(ctx, gr, err := set.GetObjectNInfo(ctx,
@ -796,9 +800,10 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
VersionID: version.VersionID, VersionID: version.VersionID,
NoDecryption: true, NoDecryption: true,
}) })
if isErrObjectNotFound(err) { if isErrObjectNotFound(err) || isErrVersionNotFound(err) {
// object deleted by the application, nothing to do here we move on. // object deleted by the application, nothing to do here we move on.
return ignore = true
break
} }
if err != nil { if err != nil {
failure = true failure = true
@ -816,6 +821,9 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
failure = false failure = false
break break
} }
if ignore {
continue
}
z.poolMetaMutex.Lock() z.poolMetaMutex.Lock()
z.poolMeta.CountItem(idx, version.Size, failure) z.poolMeta.CountItem(idx, version.Size, failure)
z.poolMetaMutex.Unlock() z.poolMetaMutex.Unlock()