-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Migrate the S3 SDK from v1 to v2 #16664
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
bd75773
to
9edbe34
Compare
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
9edbe34
to
dc21803
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16664 +/- ##
==========================================
- Coverage 68.98% 68.96% -0.03%
==========================================
Files 1562 1565 +3
Lines 200690 201770 +1080
==========================================
+ Hits 138449 139142 +693
- Misses 62241 62628 +387 ☔ View full report in Codecov by Sentry. |
u.PartSize = partSizeBytes | ||
}) | ||
object := objName(bh.dir, bh.name, filename) | ||
sendStats := bh.bs.params.Stats.Scope(stats.Operation("AWS:Request:Send")) | ||
// Using UploadWithContext breaks uploading to Minio and Ceph https://github.com/vitessio/vitess/issues/14188 | ||
_, err := uploader.Upload(&s3manager.UploadInput{ | ||
_, err := uploader.Upload(context.Background(), &s3.PutObjectInput{ |
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.
Using context.Background()
is a side-effect of the issue described in #14188. Upgrading to the SDK V2 does not fix it, the issue is rooted in how we handle the context and the goroutines. I started investigating the issue a bit deeper and will continue in a subsequent PR.
r: &request.Request{ | ||
Retryable: aws.Bool(false), | ||
}, | ||
name: "no error", |
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.
Nice refactor.
@@ -277,7 +277,7 @@ func (be *XtrabackupEngine) executeFullBackup(ctx context.Context, params Backup | |||
if err != nil { | |||
return BackupUnusable, vterrors.Wrapf(err, "cannot JSON encode %v", backupManifestFileName) | |||
} | |||
if _, err := mwc.Write([]byte(data)); err != nil { | |||
if _, err := mwc.Write(data); err != nil { |
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.
This code is going to be called regardless of s3 or other storage backend. Why this change?
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.
data
is a already a slice of bytes, I saw it while debugging something and thought I'd remove the useless conversion, I can revert if you want
Description
This PR updates the version of the AWS SDK from v1 to v2. The version 1 has been deprecated for some time now.
I have ran the following manual test:
main
branchmigrate-to-s3-v2
branch (with--restore_from_backup
)RestoreFromBackup
)main
) from AWS S3main
branch (with--restore_from_backup
)This test ensures that we can upgrade: old backups will still work with the new code, and that we can downgrade: new backups will work with the old code. While making sure that no config/flag change is needed between the two code version. It also checks that the
GetBackups
andRestoreFromBackup
vtctldclient commands work.Checklist