yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9k stars 1.07k forks source link

[docdb] PITR: allow data-only rollback from external backups #8846

Open bmatican opened 3 years ago

bmatican commented 3 years ago

Jira Link: DB-1584 Currently, we support PITR only in cluster, on snapshot schedules. This allows us to rollback both data (DML) and metadata (DDL) operations. However, the primitives are still based on snapshots, so there's nothing fundamental that would prevent us from allowing PITR on data in external backups.

To begin with, we could extend our existing yb_backup tool, to also take in a user timestamp and apply it when calling down to yb-admin restore_snapshot. A couple of limitations from this

bmatican commented 3 years ago

One other note, I was discussing with @spolitov , we currently do not keep any history retention information with the snapshot. If we did, we could potentially reject a restore to a time in the past, before the history retention.

Example: say, you had only 1h of history retention, but on restore, you provide a time that is 2h in the past, from the snapshot time. We might not have the right information for certain keys, if you were getting updates for the whole 2h, but we only kept the last 1h.

This should be easy enough to add with the snapshot information. Then when we could have access to this in the snapshot meta, that we export via yb_backup. This would allow us to then compute the max hybrid time, that is guaranteed to have data within the history retention of all snapshots and use that as a cutoff on restore.