Skip to content

Commit

Permalink
service/s3/s3manager: Document befault behavior for Upload's MaxNumPa…
Browse files Browse the repository at this point in the history
…rts (aws#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 aws#2015
  • Loading branch information
jasdel authored and xibz committed Sep 10, 2018
1 parent 8fe7254 commit d6ee51b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions service/s3/s3manager/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) },
Expand Down

0 comments on commit d6ee51b

Please sign in to comment.