-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
I am calling com.amazonaws.services.s3.transfer.TransferManager.upload(String, String, InputStream, ObjectMetadata)
and expect it to upload the stream in chunks but the API tried to upload it in one chunk.
After digging in the code a bit what I discovered this is the problematic call order:
com.amazonaws.services.s3.transfer.internal.UploadCallable.call()
com.amazonaws.services.s3.transfer.internal.UploadCallable.isMultipartUpload()
com.amazonaws.services.s3.transfer.internal.TransferManagerUtils.shouldUseMultipartUpload(PutObjectRequest, TransferManagerConfiguration)
com.amazonaws.services.s3.transfer.internal.TransferManagerUtils.getContentLength(PutObjectRequest)
The getContentLength
returns -1 if the input is a stream (and content-length wasn't supplied).
The shouldUseMultipartUpload
returns true if contentLength > configuration.getMultipartUploadThreshold()
and since -1 is not larger than that it doesn't use multi-part upload (and for me later fails because my stream is too big to buffer by the API).