From d6ee51b8228381006b15a7e5af07c9b9755daff3 Mon Sep 17 00:00:00 2001 From: Jason Del Ponte Date: Thu, 26 Jul 2018 13:21:19 -0700 Subject: [PATCH] service/s3/s3manager: Document befault behavior for Upload's MaxNumParts (#2077) Updates the S3 Upload Manager's default behavior for MaxNumParts, and ensurs that the Uploader.MaxNumPart's member value is initialized properly if the type was created via struct initialization instead of using the `NewUploader` function. Fix #2015 --- service/s3/s3manager/upload.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service/s3/s3manager/upload.go b/service/s3/s3manager/upload.go index 0adfa8ac974..0ccf634c5bc 100644 --- a/service/s3/s3manager/upload.go +++ b/service/s3/s3manager/upload.go @@ -241,6 +241,8 @@ type Uploader struct { // E.g: 5GB file, with MaxUploadParts set to 100, will upload the file // as 100, 50MB parts. // With a limited of s3.MaxUploadParts (10,000 parts). + // + // Defaults to package const's MaxUploadParts value. MaxUploadParts int // The client to use when uploading to S3. @@ -477,6 +479,9 @@ func (u *uploader) init() { if u.cfg.PartSize == 0 { u.cfg.PartSize = DefaultUploadPartSize } + if u.cfg.MaxUploadParts == 0 { + u.cfg.MaxUploadParts = MaxUploadParts + } u.bufferPool = sync.Pool{ New: func() interface{} { return make([]byte, u.cfg.PartSize) },