Skip to content
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

vttablet - add '-restore_from_backup_ts' flag #7998

Conversation

guidoiaquinti
Copy link
Member

Description

Add a new -restore_from_backup_ts flag in vttablet to restore the last backup taken at or before the provided timestamp.

Note: in a future iteration we could also add this functionality to the RestoreFromBackup gRPC call.

Related Issue(s)

This should address #4905.

Checklist

  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

N/A

@guidoiaquinti guidoiaquinti changed the title Giaquinti restorefrombackup start date vtctl - extend 'RestoreFromBackup' to pass backup start time Apr 29, 2021
@guidoiaquinti guidoiaquinti changed the title vtctl - extend 'RestoreFromBackup' to pass backup start time vttablet - add '-restore_from_backup_ts' flag Apr 29, 2021
@guidoiaquinti guidoiaquinti force-pushed the giaquinti_restorefrombackup_start_Date branch from 1f6e157 to 30ff43a Compare April 29, 2021 15:38
@guidoiaquinti guidoiaquinti marked this pull request as ready for review May 3, 2021 08:38
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main objection to this is that after restoring from the backup, the replica will try to catch-up using binlogs and if binlogs have been rotated out, then the replica will fail to go into serving.
With the current restore functionality (using the most recent backup), we can reasonably assume that binlogs are available.
The first usecase in #4905 is now covered by PITR. For the second use-case of backup validation, the way the issue is written, I assume it is expected to fail if binlogs are not available?

@guidoiaquinti
Copy link
Member Author

The main objection to this is that after restoring from the backup, the replica will try to catch-up using binlogs and if binlogs have been rotated out, then the replica will fail to go into serving.

Yes and I think we can consider this "by design" and it depends on each setup (how often do you run backups and what's the binlog retention policy).

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, but needs an actual test case.

@guidoiaquinti guidoiaquinti force-pushed the giaquinti_restorefrombackup_start_Date branch from 30ff43a to e0d72e7 Compare May 17, 2021 13:45
@mattlord
Copy link
Contributor

Hi @guidoiaquinti !

I can try and help to get this PR completed and merged (with a new test case) if you like. Or if you'd rather I can carry it forward in a new PR (giving you credit in the description/commit). Just let me know what you would prefer.

Thank you for contributing!

Matt

@mattlord mattlord self-assigned this Aug 25, 2021
@guidoiaquinti
Copy link
Member Author

👋 Hi @mattlord ,

I apologise if this PR has gone stale, but other priorities took over. Unfortunately, I don’t think I have time to work on it soon. Feel free to carry it on if you have some time.

Thanks again!

@mattlord
Copy link
Contributor

Closing this and carrying it forward here: #8824

Thank you for the PR @guidoiaquinti ! I'll make sure that you retain the proper credit/attribution. 😃

@mattlord mattlord closed this Sep 15, 2021
mattlord added a commit to planetscale/vitess that referenced this pull request Sep 15, 2021
By default Vitess will only make practical use of the latest
backup of a given shard. While this makes perfect sense for
the common use cases there are times where you need to restore
a specific backup. For example:
  1. In order to extract a portion of the data
that can then be merged with the current state. For example if
you later realize that you accidentally deleted some records
in a table that you shouldn't have last week, and you need to
perform a restore so that you can copy those specific records
back to the live data set.
  2. To perform validation, forensics, analysis on the system
state at that time.
  3. A specific PITR for whatever reason ...

This is a continuation of: vitessio#7998

This solves: vitessio#4905

Co-authored-by: Guido Iaquinti <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants