-
Notifications
You must be signed in to change notification settings - Fork 547
fix: Pass a reader with seeking support to S3 SDK upload method #18361
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
disq
approved these changes
Jun 24, 2024
Member
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.
LGTM, good explanation 🕵🏼♂️
Contributor
marianogappa
approved these changes
Jun 24, 2024
Comment on lines
+35
to
+39
| allData, err := io.ReadAll(r) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| readerSeeker := bytes.NewReader(allData) |
Contributor
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.
use bytes.Buffer + io.Copy instead (might save a bit of cycles)
kodiakhq bot
pushed a commit
that referenced
this pull request
Jun 24, 2024
🤖 I have created a release *beep* *boop* --- ## [7.2.4](plugins-destination-s3-v7.2.3...plugins-destination-s3-v7.2.4) (2024-06-24) ### Bug Fixes * **deps:** Update aws-sdk-go-v2 monorepo ([#18356](#18356)) ([b22a81d](b22a81d)) * **deps:** Update module github.com/cloudquery/filetypes/v4 to v4.2.22 ([#18349](#18349)) ([9f104f1](9f104f1)) * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.46.0 ([#18341](#18341)) ([5db9574](5db9574)) * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.46.1 ([#18350](#18350)) ([8ff8909](8ff8909)) * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.47.0 ([#18351](#18351)) ([9c5bbdc](9c5bbdc)) * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.47.1 ([#18352](#18352)) ([b31812a](b31812a)) * Pass a reader with seeking support to S3 SDK upload method ([#18361](#18361)) ([5916c95](5916c95)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq bot
pushed a commit
that referenced
this pull request
Jul 18, 2024
…#18608) #### Summary Follow up to #18361. When `no_rotate: true` we can get large files to upload and when that happens we'll be holding the whole file in memory and eventually running out of it. An example is a sync on many AWS accounts (for example 2000), even for a single table. Let's say the table data is 10MB per account, we end up with a file of 20GB. The downside of this change is that if a sync has a single account but many tables (and `no_rotate: true`), we'll run into the same issue #18361 fixed. There are workarounds for both issues (either reducing the number of accounts in the sync, or reducing the concurrency). The best solution would be to get aws/aws-sdk-go-v2#2694 fixed (suggested solution in https://github.com/aws/aws-sdk-go-v2/compare/main...erezrokah:fix/dont_over_allocate_small_files?expand=1), but doesn't seems like it's going to happen soon.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Summary
Instead of #18360, below are debug logs I've added (in the S3 SDK) to measure the over allocation when uploading batches: