-
Notifications
You must be signed in to change notification settings - Fork 202
K8SPXC-1144: mark backups as PITR unready in the storage #2261
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
Conversation
| objReader, err := stg.GetObject(ctx, filepath) | ||
| if err != nil { | ||
| if !errors.Is(err, storage.ErrObjectNotFound) { | ||
| return false, errors.Wrap(err, "get pitr-not-ready file from storage") | ||
| } | ||
| found = false | ||
| } else { | ||
| objReader.Close() | ||
| } | ||
|
|
||
| return !found, 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.
feel free the reject but i think this version can be more readable and we can get rid of found variable
| objReader, err := stg.GetObject(ctx, filepath) | |
| if err != nil { | |
| if !errors.Is(err, storage.ErrObjectNotFound) { | |
| return false, errors.Wrap(err, "get pitr-not-ready file from storage") | |
| } | |
| found = false | |
| } else { | |
| objReader.Close() | |
| } | |
| return !found, nil | |
| } | |
| if err == nil || errors.Is(err, storage.ErrObjectNotFound) { | |
| objReader.Close() | |
| return false, nil | |
| } | |
| return false, errors.Wrap(err, "get pitr-not-ready file from storage") |
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.
cmd/pitr/collector/collector.go
Outdated
| lastSetFilePrefix string = "last-binlog-set-" // filename prefix for object where the last binlog set will stored | ||
| gtidPostfix string = "-gtid-set" // filename postfix for files with GTID set | ||
| timelinePath string = "/tmp/pitr-timeline" // path to file with timeline | ||
| lastSetFilePrefix string = "last-binlog-set-" // filename prefix for object where the last binlog set will stored |
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.
will be stored
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.
pkg/pxc/backup/pitr.go
Outdated
| } | ||
| scli, err := storageFunc(ctx, opts) | ||
| if err != nil { | ||
| return errors.Wrap(err, "failed to create s3 client") |
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.
Is the s3 client always the case for storage?
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.
| filepath := bcp.Status.Destination.BackupName() + "." + naming.PITRNotReady | ||
| objReader, err := stg.GetObject(ctx, filepath) | ||
| if err == nil { | ||
| objReader.Close() |
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.
should we handle the error this returns?
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.
At least we can log it, maybe
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.
We handle it below
commit: 65dc354 |
https://perconadev.atlassian.net/browse/K8SPXC-1144
DESCRIPTION
Problem:
When performing a PITR restore using
backupSource, we currently do not throw an error when a gap is detected.Solution:
The operator should create a file named
<backup-name>.pitr-not-readyin the storage whenever a gap is detected.Before starting a restore, the operator must check whether this file exists in the storage, and if it does, the operator should throw an error.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability