Skip to content

replica: point-in-time restore edge cases - #3

Merged
mcollina merged 2 commits into
mainfrom
feat/pitr-edge-cases
Oct 13, 2026
Merged

mcollina merged 2 commits into
mainfrom
feat/pitr-edge-cases

Conversation

@mcollina

Copy link
Copy Markdown
Member

Point-in-time restore edge cases for Replica.restore().

RestoreOptions.timestamp is now wired through restore() to calcRestorePlan(), so a restore can target the latest backup created at/before a given time as well as a txID boundary. Targets are validated: a negative txID, an invalid date, or passing both txID and timestamp are rejected with InvalidArgumentError. Timestamp restores query backends with useMetadata so createdAt is accurate and only use files created strictly before the target.

Added RestoreGapError (ERR_RESTORE_GAP): a "latest" restore over a non-contiguous file set now fails instead of silently restoring a partial database.

New PITR integration tests cover txID-boundary restore, timestamp restore, out-of-range targets (NoMatchingBackupError), txID/timestamp mutual exclusion, negative txID, and non-contiguous files (RestoreGapError).

Wire RestoreOptions.timestamp through restore() -> calcRestorePlan() so a
restore can target the latest backup at/before a given time (in addition to a
txID boundary). Validate targets: reject negative txID, invalid dates, and
passing both txID and timestamp. Timestamp restores query backends with
useMetadata so createdAt is accurate, and only use files created strictly
before the target.

Add a RestoreGapError (ERR_RESTORE_GAP): a 'latest' restore over a
non-contiguous file set now fails instead of silently returning a partial
database. New PITR integration tests cover txID boundaries, timestamp restore,
out-of-range targets, mutual exclusion, negative txID, and non-contiguous
files.
Point-in-time restore (txID + timestamp) is now implemented and tested, so it
no longer belongs under 'Deferred features'.
@mcollina
mcollina merged commit 1c10c8b into main Oct 13, 2026
3 checks passed
@mcollina
mcollina deleted the feat/pitr-edge-cases branch October 13, 2026 13:33
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.

1 participant