yugabyte-db
yugabyte-db copied to clipboard
[DocDB] PITR: Restore to a time just before the oldest snapshot fails even if it is within the retention window
Jira Link: DB-10187
Description
Currently PITR is allowing restore only upto the snapshot creation time of the oldest snapshot.
If PITR is enabled with a snapshot interval of 2min and a retention period of 6mins, theoretically it should be possible to restore to 2024-03-01 10:26:00 given the set of snapshots below.
Snapshot UUID State Creation Time
d1659d21-2de7-4bab-8e77-186c46f7aca8 COMPLETE 2024-03-01 10:26:17.579703
9a812e02-b20e-473a-8678-253bdf9262ba COMPLETE 2024-03-01 10:28:22.640780
884ca49e-0adf-462a-8b56-62208737505d COMPLETE 2024-03-01 10:30:27.744028
However, during restoration code currently assumes that the oldest snapshot does not have any history and therefore fails the restore with the following error:
Error running restore_snapshot_schedule: Illegal state (yb/master/master_snapshot_coordinator.cc:206): Trying to restore to { days: 19783 time: 10:26:00.526259 } which is earlier than the configured retention. Not allowed. Earliest snapshot that can be used is d1659d21-2de7-4bab-8e77-186c46f7aca8 and was taken at { days: 19783 time: 10:26:17.579703 }.
Only the first ever snapshot after PITR is enabled might be missing history for 2 minutes, but every subsequent snapshot covers the interval between 2 consecutive snapshots and therefore restore to a time before the oldest snapshot creation time and most recently garbage collected snapshot should be possible.
Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information
- [X] I confirm this issue does not contain any sensitive information.