-
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
Fix xtrabackup
/builtin
context when doing AddFiles
#16806
Conversation
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
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
|
xtrabackup
context when doing AddFiles
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16806 +/- ##
==========================================
- Coverage 69.53% 69.49% -0.04%
==========================================
Files 1567 1569 +2
Lines 202388 202644 +256
==========================================
+ Hits 140723 140826 +103
- Misses 61665 61818 +153 ☔ View full report in Codecov by Sentry. |
@frouioui with your PR I can no longer listing backup for example: /vt/bin/vtctldclient --server=vtctld:15999 --logtostderr=true GetBackups unsharded/-
E0919 12:12:39.588828 27 main.go:56] rpc error: code = Unknown desc = operation error S3: HeadBucket, https response error StatusCode: 301, RequestID: 2ACET95HY572K3PX, HostID: X2nVlauIKbd8pM8PqINAZCTtrmJ7LmHkCHVrCZq9tTbR3cLb8s4AnS/SnrELiZzroPbO69weCZ4=, api error MovedPermanently: Moved Permanently |
Interesting, may I know what flags (redacted) you are using? We recently changed the SDK version, that might be the cause. |
@frouioui |
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@L3o-pold this should be fixed now, at least on my end with Minio I am able to do all kind of backup operations. |
xtrabackup
context when doing AddFiles
xtrabackup
/builtin
context when doing AddFiles
@frouioui it works great congrats and thanks <3 |
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.
💯
go/vt/mysqlctl/s3backupstorage/s3.go
Outdated
@@ -47,6 +47,8 @@ import ( | |||
"github.com/aws/smithy-go/middleware" | |||
"github.com/spf13/pflag" | |||
|
|||
smithyendpoints "github.com/aws/smithy-go/endpoints" |
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.
nit: I don't see why this needs an override.
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.
Fixed via 1102c59, we still need an override though using simply "endpoints", the IDE and compiler was not happy. Not exactly sure why, but in the migration docs, they also use override, and the package is named "transport" (even if the path is endpoint), so i ended up overriding it by "transport".
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
func newEndpointResolver() *endpointResolver { | ||
return &endpointResolver{ | ||
r: s3.NewDefaultEndpointResolverV2(), | ||
endpoint: &endpoint, |
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.
Would be nice IMO to have a comment about what this is here:
endpoint: &endpoint, | |
endpoint: &endpoint, // Use default endpoint of amazonaws.com |
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 is already the case in the variable definition:
// AWS endpoint, defaults to amazonaws.com but appliances may use a different location
endpoint string
Description
This PR fixes a long standing issue in the xtrabackup engine: the context used to
AddFiles
by the backup storage was canceled beforeAddFiles
had the chance to complete. This problem can be experienced with the S3 backup storage, as it uploads the file through a goroutine, Ceph also does that and have been impacted in the past too. That goroutine wouldn't have time to complete before theXtrabackupEngine.backupFiles
function returned and canceled the context through adefer
statement. Leading toAddFiles
failing since the context we pass got canceled.To avoid this issue, we never really passed the context down to
AddFiles
. We attempted to pass the context in #12500 but reverted it in #14311 since #14188 was raised.This PR fixes that by not canceling the context automatically, but only when the
backupFiles
return an error. If we have an error anywhere while executingbackupFiles
we should attempt to cancel the addition of the files, otherwise we can assume there is nothing to cancel. A different goroutine already make sure to cancel the context if we reach a certain timeout when closing the files.cc @L3o-pold @vczyh as the original authors of the two issues. I have tested this on my end with manual tests (only on S3), but do you mind making sure it fixes your issues?
Related Issue(s)
Checklist