From 85d2187c203bbebacf78d331fabf1392841ff9dc Mon Sep 17 00:00:00 2001 From: Poorna Krishnamoorthy Date: Sat, 20 Feb 2021 00:22:17 -0800 Subject: [PATCH] fix: ETag mismatch for large upload in replica (#11587) --- cmd/bucket-replication.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index 5cacdb710..7e3fd6ac3 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -645,6 +645,8 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa } } replicationStatus := replication.Completed + // use core client to avoid doing multipart on PUT + c := &miniogo.Core{Client: tgt.Client} if rtype != replicateAll { // replicate metadata for object tagging/copy with metadata replacement srcOpts := miniogo.CopySrcOptions{ @@ -652,8 +654,6 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa Object: object, VersionID: objInfo.VersionID} dstOpts := miniogo.PutObjectOptions{Internal: miniogo.AdvancedPutOptions{SourceVersionID: objInfo.VersionID}} - c := &miniogo.Core{Client: tgt.Client} - if _, err = c.CopyObject(ctx, dest.Bucket, object, dest.Bucket, object, getCopyObjMetadata(objInfo, dest), srcOpts, dstOpts); err != nil { replicationStatus = replication.Failed logger.LogIf(ctx, fmt.Errorf("Unable to replicate metadata for object %s/%s(%s): %s", bucket, objInfo.Name, objInfo.VersionID, err)) @@ -697,7 +697,7 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa // r takes over closing gr. r := bandwidth.NewMonitoredReader(ctx, globalBucketMonitor, objInfo.Bucket, objInfo.Name, gr, headerSize, b, target.BandwidthLimit) - if _, err = tgt.PutObject(ctx, dest.Bucket, object, r, size, putOpts); err != nil { + if _, err = c.PutObject(ctx, dest.Bucket, object, r, size, "", "", putOpts); err != nil { replicationStatus = replication.Failed logger.LogIf(ctx, fmt.Errorf("Unable to replicate for object %s/%s(%s): %w", bucket, objInfo.Name, objInfo.VersionID, err)) }