-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example putObjectWithProcess is incorrect. #2468
Comments
I was confused before but now I think I got the answer. when we upload a file use the API
first step: it will construct a maybe the first step very fast, and you will see the progress jumps straight to 50%(if the read initializing to 0), so I think there is no obvious difference between by initializing Here is the code in the SDK aws/aws-sdk-go/service/s3/s3manager/upload.go
aws-sdk-go/aws/request/request.go
|
Fixes the S3 Upload manager example to correctly track the progress uploading a file to S3. This change is able to correct the issue of double size counting by disabling computing the hash of the file to upload. Fix aws#2468
Thanks for the update and feedback. The double read is triggered by the SDK's need to compute a hash of the payload to upload, so that it can be included in the request's signature, along with determining the length of the payload to send. We're looking at optimizations for the request signature's payload hash for S3, that we might be able to implement in the future removing the need to compute the hash for a payload over TLS, but this work is still outstanding and I don't have a timeline on it sorry. With that said I think the example can workaround this double read of the payload by changing when the progress tracker is injected. Instead of wrapping the I put together PR #2456 that fixes this. |
Re-opening this to track fixing getObjectWithProgress and putObjectWithProgress examples. |
=== ### Service Client Updates * `service/ec2`: Updates service API and documentation * Remove CoIP Auto-Assign feature references. * `service/glue`: Updates service API and documentation * Starting today, you can further control orchestration of your ETL workloads in AWS Glue by specifying the maximum number of concurrent runs for a Glue workflow. * `service/savingsplans`: Updates service API ### SDK Enhancements * `aws/credentials/stscreds`: Add optional expiry duration to WebIdentityRoleProvider ([#3356](#3356)) * Adds a new optional field to the WebIdentityRoleProvider that allows you to specify the duration the assumed role credentials will be valid for. * `example/service/s3/putObjectWithProgress`: Fix example for file upload with progress ([#3377](#3377)) * Fixes [#2468](#2468) by ignoring the first read of the progress reader wrapper. Since the first read is used for signing the request, not upload progress. * Updated the example to write progress inline instead of newlines. * `service/dynamodb/dynamodbattribute`: Fix typo in package docs ([#3446](#3446)) * Fixes typo in dynamodbattribute package docs.
Release v1.34.1 (2020-08-10) === ### Service Client Updates * `service/ec2`: Updates service API and documentation * Remove CoIP Auto-Assign feature references. * `service/glue`: Updates service API and documentation * Starting today, you can further control orchestration of your ETL workloads in AWS Glue by specifying the maximum number of concurrent runs for a Glue workflow. * `service/savingsplans`: Updates service API ### SDK Enhancements * `aws/credentials/stscreds`: Add optional expiry duration to WebIdentityRoleProvider ([#3356](#3356)) * Adds a new optional field to the WebIdentityRoleProvider that allows you to specify the duration the assumed role credentials will be valid for. * `example/service/s3/putObjectWithProgress`: Fix example for file upload with progress ([#3377](#3377)) * Fixes [#2468](#2468) by ignoring the first read of the progress reader wrapper. Since the first read is used for signing the request, not upload progress. * Updated the example to write progress inline instead of newlines. * `service/dynamodb/dynamodbattribute`: Fix typo in package docs ([#3446](#3446)) * Fixes typo in dynamodbattribute package docs.
is there any good example to track file uploading progress coded in golang? |
Please fill out the sections below to help us address your issue.
Version of AWS SDK for Go?
Any
Version of Go (
go version
)?go11.5
What issue did you see?
The sample code at https://github.com/aws/aws-sdk-go/tree/master/example/service/s3/putObjectWithProcess is incorrect.
Steps to reproduce
From #1868:
"the example is broken... What happens is that the uploader reads the whole thing twice, haven't dug into why but I think it has to do with determining the number of parts. The first read is very fast as the contents are discarded. The second actually seems to be piped to the upload.
The sample reports progress by dividing the number of bytes read by two, so what I'm seeing is that it jumps straight to 50%, and then proceeds to 100% at half the actual "speed". I "fixed" it by initializing
read
to-size
, starting to report when read passes 0."Sample fix:
The text was updated successfully, but these errors were encountered: