-
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
Backup: --incremental-from-pos
supports backup name
#14923
Backup: --incremental-from-pos
supports backup name
#14923
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
…Pos public Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
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
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14923 +/- ##
=======================================
Coverage ? 47.64%
=======================================
Files ? 1151
Lines ? 239843
Branches ? 0
=======================================
Hits ? 114281
Misses ? 116963
Partials ? 8599 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Shlomi Noach <[email protected]>
Documented in |
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.
LGTM. Just a few minor suggestions.
At first I wasn't crazy about re-using the existing flag, but after reading through it and thinking about it I think it's fine. The backup name is a pointer to a pos, whatever pos that file had. We'll just need to document it of course here: https://vitess.io/docs/19.0/user-guides/operating-vitess/backup-and-restore/creating-a-backup/#create-an-incremental-backup-with-vtctl
The only reason that I didn't approve here, is that we should update the --incremental-from-pos
/--incremental_from_pos
flag related text:
- https://github.com/vitessio/vitess/blob/main/go/cmd/vtctldclient/command/backups.go
- https://github.com/vitessio/vitess/blob/main/go/vt/vtctl/backup.go
- https://github.com/vitessio/vitess/blob/main/go/cmd/vtbackup/cli/vtbackup.go
Unless I'm missing something here?
Co-authored-by: Matt Lord <[email protected]> Signed-off-by: Shlomi Noach <[email protected]>
…/vitess into incremental-from-backup-name Signed-off-by: Shlomi Noach <[email protected]>
Co-authored-by: Matt Lord <[email protected]> Signed-off-by: Shlomi Noach <[email protected]>
…/vitess into incremental-from-backup-name Signed-off-by: Shlomi Noach <[email protected]>
Co-authored-by: Matt Lord <[email protected]> Signed-off-by: Shlomi Noach <[email protected]>
…/vitess into incremental-from-backup-name Signed-off-by: Shlomi Noach <[email protected]>
I'm not sure what's going on. I'm absolutely certain I updated the flag docs in all places 😱 . Anyway, updating again. |
I think ideally the flag should be renamed |
Signed-off-by: Shlomi Noach <[email protected]>
Updated all CLI docs. |
Signed-off-by: Shlomi Noach <[email protected]>
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.
Thanks, @shlomi-noach ! ❤️
New docs PR in vitessio/website#1667, cleaner. |
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.
All my comments are minor. Please feel free to merge once they are addressed.
|
||
Backup.Flags().BoolVar(&backupOptions.UpgradeSafe, "upgrade-safe", false, "Whether to use innodb_fast_shutdown=0 for the backup so it is safe to use for MySQL upgrades.") | ||
Root.AddCommand(Backup) | ||
|
||
BackupShard.Flags().BoolVar(&backupShardOptions.AllowPrimary, "allow-primary", false, "Allow the primary of a shard to be used for the backup. WARNING: If using the builtin backup engine, this will shutdown mysqld on the primary and stop writes for the duration of the backup.") | ||
BackupShard.Flags().Int32Var(&backupShardOptions.Concurrency, "concurrency", 4, "Specifies the number of compression/checksum jobs to run simultaneously.") | ||
BackupShard.Flags().StringVar(&backupShardOptions.IncrementalFromPos, "incremental-from-pos", "", "Position of previous backup. Default: empty. If given, then this backup becomes an incremental backup from given position. If value is 'auto', backup taken from last successful backup position") | ||
BackupShard.Flags().StringVar(&backupShardOptions.IncrementalFromPos, "incremental-from-pos", "", "Position, or name of backup from which to create an incremental backup. Default: empty. If given, then this backup becomes an incremental backup from given position or given backup. If value is 'auto', backup taken from last successful backup position.") |
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.
Make this consistent with the other places.
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.
@@ -291,6 +294,19 @@ func (be *BuiltinBackupEngine) executeIncrementalBackup(ctx context.Context, par | |||
if err != nil { | |||
return false, vterrors.Wrapf(err, "cannot get binary logs in incremental backup") | |||
} | |||
|
|||
// @@gtid_purged |
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 this comment line needed? Doesn't seem to add anything.
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.
Removed.
go/vt/vtctl/backup.go
Outdated
@@ -72,7 +72,7 @@ func init() { | |||
func commandBackup(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error { | |||
concurrency := subFlags.Int32("concurrency", 4, "Specifies the number of compression/checksum jobs to run simultaneously") | |||
allowPrimary := subFlags.Bool("allow_primary", false, "Allows backups to be taken on primary. Warning!! If you are using the builtin backup engine, this will shutdown your primary mysql for as long as it takes to create a backup.") | |||
incrementalFromPos := subFlags.String("incremental_from_pos", "", "Position of previous backup. Default: empty. If given, then this backup becomes an incremental backup from given position. If value is 'auto', backup taken from last successful backup position") | |||
incrementalFromPos := subFlags.String("incremental_from_pos", "", "Position, or name of backup from which to create an incremental backup. Default: empty. If given, then this backup becomes an incremental backup from given position or given backup. If value is 'auto', backup taken from last successful backup position.") |
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.
Make this consistent with all other flag docs.
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.
go/vt/vtctl/backup.go
Outdated
@@ -114,7 +114,7 @@ func (b *backupEventStreamLogger) Send(resp *vtctldatapb.BackupResponse) error { | |||
func commandBackupShard(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error { | |||
concurrency := subFlags.Int32("concurrency", 4, "Specifies the number of compression/checksum jobs to run simultaneously") | |||
allowPrimary := subFlags.Bool("allow_primary", false, "Whether to use primary tablet for backup. Warning!! If you are using the builtin backup engine, this will shutdown your primary mysql for as long as it takes to create a backup.") | |||
incrementalFromPos := subFlags.String("incremental_from_pos", "", "Position of previous backup. Default: empty. If given, then this backup becomes an incremental backup from given position. If value is 'auto', backup taken from last successful backup position") | |||
incrementalFromPos := subFlags.String("incremental_from_pos", "", "Position, or name of backup from which to create an incremental backup. Default: empty. If given, then this backup becomes an incremental backup from given position or given backup. If value is 'auto', backup taken from last successful backup position.") |
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.
And this too.
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.
Co-authored-by: Deepthi Sigireddi <[email protected]> Signed-off-by: Shlomi Noach <[email protected]>
Co-authored-by: Deepthi Sigireddi <[email protected]> Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Description
Running an incremental backup, up till now the flag
--incremental-from-pos
supported:"auto"
It now also supports a backup name. If such named backup exists, then the incremental backup will start with the position of the named backup.
A bit of refactoring made, especially around
endtoend
tests, to accommodate.Docs:
vitessio/website#1662vitessio/website#1667Related Issue(s)
Fixes #14905
Checklist
Deployment Notes