Skip to content
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

S3ng include md5 checksum on put #4100

Merged
merged 4 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-logging-upload-errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix logging upload errors

We fixed a problem where problems with uploading blobs to the blobstore weren't logged.

https://github.com/cs3org/reva/pull/4099
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-s3-put-md5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: S3ng include md5 checksum on put

We've fixed the S3 put operation of the S3ng storage to include a md5 checksum.

This md5 checksum is needed when a bucket has a retention period configured (see https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html).

https://github.com/cs3org/reva/pull/4100
4 changes: 2 additions & 2 deletions pkg/storage/fs/s3ng/blobstore/blobstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func (bs *Blobstore) Upload(node *node.Node, source string) error {
}
defer reader.Close()

_, err1 := bs.client.PutObject(context.Background(), bs.bucket, bs.path(node), reader, node.Blobsize, minio.PutObjectOptions{ContentType: "application/octet-stream"})
_, err = bs.client.PutObject(context.Background(), bs.bucket, bs.path(node), reader, node.Blobsize, minio.PutObjectOptions{ContentType: "application/octet-stream", SendContentMd5: true})
Copy link
Contributor

@butonic butonic Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a performance problem. SendContentMd5: true causes minio-go to reread the whole file before making the actual putobject request as it needs to send a Content-MD5 header. Maybe a more recent version of minio-go supports sending that as a trailer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah ... we can't send our MD5 with this lib ... the SendContentMd5 flag will always calculate the hash itself and there is no way to sneak in a Content-MD5 header.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's try to get a fix into upstream: minio/minio-go#1867


if err1 != nil {
if err != nil {
return errors.Wrapf(err, "could not store object '%s' into bucket '%s'", bs.path(node), bs.bucket)
}
return nil
Expand Down
1 change: 1 addition & 0 deletions pkg/storage/utils/decomposedfs/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ func (upload *Upload) FinishUpload(_ context.Context) error {
err = upload.Finalize()
Cleanup(upload, err != nil, false)
if err != nil {
log.Error().Err(err).Msg("failed to upload")
return err
}
}
Expand Down
Loading