-
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
Hi, I have recently upgraded to Vitess v21 from v20. Now the backup fails with the following error:
I haven't changed how the backup configuration works and the s3 credentials and configuration are correct, I copy it here:
Any idea what this could be? Seems more an issue with this PR. Thank you! |
I think I have found the issue. Seems a bug with the fact that it does not check if the endpoint config is not specified and if not specified it uses an empty value instead of completely ignoring it and constructing the URL from the other parameters. I managed to get it working by specifying this in the spec:
|
Thank you @frouioui. As soon as released I will test it. I want to raise also the fact that even in the case I specified a custom endpoint to make the backup working after a certain point during the finalization of the backup for a large table that we have called usertrack we get this error:
I then downgraded to vitess v20.0.3 and this issue seems not to happen with this version. Not sure if it is something related with the upgrade of the S3 SDK. |
This is fixed by #17285 and is already included in the upcoming 21.0.1 release. |
Awesome, thank you @frouioui. |
Thanks for that! If you see any issue, let me know :) |
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