-
Notifications
You must be signed in to change notification settings - Fork 4
Implement AOS-62 WriteMultipart returns Part #88
Conversation
storage.go
Outdated
Key: aws.String(o.ID), | ||
UploadId: aws.String(o.MustGetMultipartID()), | ||
ContentLength: &size, | ||
Body: iowrap.SizedReadSeekCloser(r, size), | ||
Body: aws.ReadSeekCloser(r), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need to migrate from iowrap.SizedReadSeekCloser
to aws.ReadSeekCloser
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why WirteMultipart
got the RequestError
in the last commit. I found that aws.ReadSeekCloser
is used in write
, so I migrated to aws.ReadSeekCloser
to have a try. The error info is:
RequestError: send request failed
...
net/http: HTTP/1.x transport connection broken: http: ContentLength=1543539 with Body length 0'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please figure out why.
If there is a bug in iowrap, please fix it. Don't solve problem by skip it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something buggy in https://github.com/aos-dev/go-storage/blob/master/pkg/iowrap/reader.go#L93-L108 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S3 SDK will compute Content MD5 by default which will consume our input reader. However, our input reader is a bytes.Reader
which can only be consumed once.
In go-storage, we will let users to calculate content md5 and passed into as a pair Content-MD5
.
So we need to set S3DisableContentMD5Validation
to true to disable the auto content md5 check.
cfg.S3DisableContentMD5Validation = aws.Bool(true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change it back, we will use our own iowrap
instead of the one provided by SDK.
ref: beyondstorage/go-storage#571.