Skip to content

Commit

Permalink
check bucket locking status before clean up (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
bentsku authored Sep 13, 2023
1 parent 3dd0180 commit 7a904a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/bench/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ func (c *Common) deleteAllInBucket(ctx context.Context, prefixes ...string) {
}
}()

errCh := cl.RemoveObjects(ctx, c.Bucket, objectsCh, minio.RemoveObjectsOptions{GovernanceBypass: true})
delOpts := minio.RemoveObjectsOptions{}
_, _, _, errLock := cl.GetBucketObjectLockConfig(ctx, c.Bucket)
if errLock == nil {
delOpts.GovernanceBypass = true
}

errCh := cl.RemoveObjects(ctx, c.Bucket, objectsCh, delOpts)
for err := range errCh {
if err.Err != nil {
c.Error(err.Err)
Expand Down

0 comments on commit 7a904a2

Please sign in to comment.