From 2518af5f9e0e8b5e88e9a438646f65d9b9cfe439 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 6 Jul 2022 09:53:16 -0700 Subject: [PATCH] fix: allow certain mutations on objects during decommissioning (#15231) fix: allow certain mutation on objects during decommission currently by mistake deletion of objects was skipped, if the object resided on the pool being decommissioned. delete's are okay to be allowed since decommission is designed to run on a cluster with active I/O. --- cmd/erasure-server-pool.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index ec4b71fc7..cedfe3add 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -1003,7 +1003,6 @@ func (z *erasureServerPools) DeleteObject(ctx context.Context, bucket string, ob return z.serverPools[0].DeleteObject(ctx, bucket, object, opts) } - opts.Mutate = true idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, object, opts) if err != nil { return objInfo, err @@ -1053,7 +1052,9 @@ func (z *erasureServerPools) DeleteObjects(ctx context.Context, bucket string, o j := j obj := obj eg.Go(func() error { - idx, err := z.getPoolIdxExistingNoLock(ctx, bucket, obj.ObjectName) + idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, obj.ObjectName, ObjectOptions{ + NoLock: true, + }) if err != nil { derrs[j] = err return nil @@ -2208,7 +2209,6 @@ func (z *erasureServerPools) PutObjectMetadata(ctx context.Context, bucket, obje } // We don't know the size here set 1GiB atleast. - opts.Mutate = true idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, object, opts) if err != nil { return ObjectInfo{}, err @@ -2225,7 +2225,6 @@ func (z *erasureServerPools) PutObjectTags(ctx context.Context, bucket, object s } // We don't know the size here set 1GiB atleast. - opts.Mutate = true idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, object, opts) if err != nil { return ObjectInfo{}, err @@ -2241,7 +2240,6 @@ func (z *erasureServerPools) DeleteObjectTags(ctx context.Context, bucket, objec return z.serverPools[0].DeleteObjectTags(ctx, bucket, object, opts) } - opts.Mutate = true idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, object, opts) if err != nil { return ObjectInfo{}, err @@ -2273,7 +2271,7 @@ func (z *erasureServerPools) TransitionObject(ctx context.Context, bucket, objec return z.serverPools[0].TransitionObject(ctx, bucket, object, opts) } - opts.Mutate = true + opts.Mutate = true // Avoid transitioning an object from a pool being decommissioned. idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, object, opts) if err != nil { return err @@ -2289,7 +2287,7 @@ func (z *erasureServerPools) RestoreTransitionedObject(ctx context.Context, buck return z.serverPools[0].RestoreTransitionedObject(ctx, bucket, object, opts) } - opts.Mutate = true + opts.Mutate = true // Avoid restoring object from a pool being decommissioned. idx, err := z.getPoolIdxExistingWithOpts(ctx, bucket, object, opts) if err != nil { return err