From 506f121576b6fa582dfc89c175ceacd66a1f8465 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 26 Nov 2023 22:18:09 -0800 Subject: [PATCH] remove frivolous logging in transition object (#18526) AWS S3 closes keep-alive connections frequently leading to frivolous logs filling up the MinIO logs when the transition tier is an AWS S3 bucket. Ignore such transient errors, let MinIO retry it when it can. --- cmd/bucket-lifecycle.go | 9 ++++++--- cmd/erasure-object.go | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/bucket-lifecycle.go b/cmd/bucket-lifecycle.go index f7f44c89c..8d4807542 100644 --- a/cmd/bucket-lifecycle.go +++ b/cmd/bucket-lifecycle.go @@ -42,6 +42,7 @@ import ( "github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/s3select" "github.com/minio/pkg/v2/env" + xnet "github.com/minio/pkg/v2/net" "github.com/minio/pkg/v2/workers" "github.com/zeebo/xxh3" ) @@ -289,9 +290,11 @@ func (t *transitionState) worker(objectAPI ObjectLayer) { } atomic.AddInt32(&t.activeTasks, 1) if err := transitionObject(t.ctx, objectAPI, task.objInfo, newLifecycleAuditEvent(task.src, task.event)); err != nil { - if !isErrVersionNotFound(err) && !isErrObjectNotFound(err) { - logger.LogIf(t.ctx, fmt.Errorf("Transition to %s failed for %s/%s version:%s with %w", - task.event.StorageClass, task.objInfo.Bucket, task.objInfo.Name, task.objInfo.VersionID, err)) + if !isErrVersionNotFound(err) && !isErrObjectNotFound(err) && !xnet.IsNetworkOrHostDown(err, false) { + if !strings.Contains(err.Error(), "use of closed network connection") { + logger.LogIf(t.ctx, fmt.Errorf("Transition to %s failed for %s/%s version:%s with %w", + task.event.StorageClass, task.objInfo.Bucket, task.objInfo.Name, task.objInfo.VersionID, err)) + } } } else { ts := tierStats{ diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index edb429e41..fb402c624 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -317,7 +317,6 @@ func (er erasureObjects) getObjectWithFileInfo(ctx context.Context, bucket, obje // Reply back invalid range if the input offset and length fall out of range. if startOffset > fi.Size || startOffset+length > fi.Size { - logger.LogIf(ctx, InvalidRange{startOffset, length, fi.Size}, logger.Application) return InvalidRange{startOffset, length, fi.Size} } @@ -2249,7 +2248,6 @@ func (er erasureObjects) TransitionObject(ctx context.Context, bucket, object st rv, err = tgtClient.Put(ctx, destObj, pr, fi.Size) pr.CloseWithError(err) if err != nil { - logger.LogIf(ctx, fmt.Errorf("Unable to transition %s/%s(%s) to %s tier: %w", bucket, object, opts.VersionID, opts.Transition.Tier, err)) return err } fi.TransitionStatus = lifecycle.TransitionComplete