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

Replace minio-go with aws-sdk-go for s3-compatible log backend #670

Merged
merged 4 commits into from Jan 10, 2018

Conversation

gviedma-zz
Copy link

@gviedma-zz gviedma-zz commented Jan 10, 2018

Minio-go has a couple of deficiencies that are resolved by switching to aws-sdk-go for our s3 client driver.

  1. There is a bug when uploading small files in streaming mode (size = -1) that results in an EOF error being thrown by the client. Related to this is the following bug Uploading small files of unknown size uses too much memory minio/minio-go#848 As a result, it is not possible to use a generic io.Reader interface, since the size of the uploaded object must be computed prior to making a request. This would preclude any kind of streaming readers in the future.
  2. Minio-go uses a strict date parsing format which makes it throw an unrecoverable error when parsing the Last-Modified header in an HTTP response. This makes it incompatible with some major cloud vendor S3/Object Storage implementations, for example Oracle's.

Also fixes #646

logrus.WithFields(logrus.Fields{"bucketName": s.bucket, "key": objectName}).Debug("Downloading log")

// stream the logs to an in-memory buffer
target := &aws.WriteAtBuffer{}
Copy link
Contributor

Choose a reason for hiding this comment

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

have used https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#S3.GetObject w/ some success in the past to avoid having to copy into a buffer here, am less familiar with the s3Manager api.

Copy link
Contributor

Choose a reason for hiding this comment

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

happy to punt on optimizing here

Copy link
Author

Choose a reason for hiding this comment

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

I think that should work as well. Will look at making the change tomorrow.

Copy link
Author

Choose a reason for hiding this comment

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

@rdallman I've looked into replacing this with s3.GetObject and the challenge there is that we wouldn't be able to simply return the Body of s3.GetObjectOutput as the io.Reader result of GetLog. The reason is that the result body needs to be closed in order to not leak connections (see aws/aws-sdk-go#408), so unfortunately we wouldn't be able to avoid copying into an intermediate buffer.

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha. we could change LogStore.GetLog to return an io.ReadCloser ?

Copy link
Contributor

@rdallman rdallman left a comment

Choose a reason for hiding this comment

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

thanks for digging in, looks good.

fwiw aws is releasing a sdk 2.0 for go https://aws.amazon.com/blogs/developer/aws-sdk-for-go-2-0-developer-preview/ that is supposed to be less nasty, we could probably migrate pretty easily since the surface area is pretty small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add metric for log bytes uploaded/downloaded, latency for all log stores
3 participants