feat: upgrade Go dependencies and optimize S3 uploads - #13
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new S3 multipart implementation has a compile-time error (sync.WaitGroup has no Go method) and an incorrect size-limit validation that can allow oversized uploads to proceed until S3 rejects them.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR upgrades several Go dependencies (AWS SDK, Elasticsearch client, gopsutil, testify) and refactors S3 uploads to use AWS SDK v2 with an optimized multipart upload path to avoid buffering large files in memory.
Changes:
- Migrates S3 uploads from
aws-sdk-gov1 toaws-sdk-go-v2, adding a custom multipart implementation with bounded concurrency. - Upgrades Elasticsearch client usage from
go-elasticsearch/v6togo-elasticsearch/v7, and adds an HTTP-based test for bulk indexing. - Updates system status collection to
gopsutil/v4, and bumps the module Go version plus dependency sums.
File summaries
| File | Description |
|---|---|
| storage/s3.go | Switches to AWS SDK v2; adds single-part vs multipart upload logic and concurrency. |
| storage/s3_test.go | Adds unit tests for both single PUT and multipart behavior (retry, abort, memory usage). |
| storage/es.go | Updates Elasticsearch v6 client import to v7. |
| storage/es_test.go | Adds HTTP server-backed test covering ES v7 bulk request behavior. |
| common/sys_status.go | Updates gopsutil imports from v3 to v4. |
| go.mod | Bumps Go version and updates required modules for AWS SDK v2, ES v7, gopsutil v4, etc. |
| go.sum | Updates module checksums consistent with the dependency upgrades. |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+83
to
+87
| // Grow parts for large files without exceeding S3's 10,000-part limit. | ||
| partSize := max(s3UploadPartSize, (size-1)/10000+1) | ||
| if partSize > 5*1024*1024*1024 { | ||
| return errors.New("file exceeds the S3 multipart upload size limit") | ||
| } |
Comment on lines
+117
to
+121
| var wg sync.WaitGroup | ||
| var once sync.Once | ||
| var firstErr error | ||
| for range min(5, partCount) { | ||
| wg.Go(func() { |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.