Skip to content

Commit fc0e68d

Browse files
authored
Merge pull request #1293 from devoxel/bug1291
gcs: mitigate transient errors causing corruption
2 parents 1f702e8 + 980ad1f commit fc0e68d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/storage/gcs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ func (gcs *GCS) PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser
278278
}
279279
pClient := pClientObj.(*clientObject).Client
280280
obj := pClient.Bucket(gcs.Config.Bucket).Object(key)
281+
// always retry transient errors to mitigate retry logic bugs.
282+
obj = obj.Retryer(storage.WithPolicy(storage.RetryAlways))
281283
writer := obj.NewWriter(ctx)
282284
writer.ChunkSize = gcs.Config.ChunkSize
283285
writer.StorageClass = gcs.Config.StorageClass
@@ -364,6 +366,8 @@ func (gcs *GCS) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey
364366
pClient := pClientObj.(*clientObject).Client
365367
src := pClient.Bucket(srcBucket).Object(srcKey)
366368
dst := pClient.Bucket(gcs.Config.Bucket).Object(dstKey)
369+
// always retry transient errors to mitigate retry logic bugs.
370+
dst = dst.Retryer(storage.WithPolicy(storage.RetryAlways))
367371
attrs, err := src.Attrs(ctx)
368372
if err != nil {
369373
if pErr := gcs.clientPool.InvalidateObject(ctx, pClientObj); pErr != nil {

0 commit comments

Comments
 (0)