Build a Point-in-Time Restore Plan From Full, Diff and Log Backups
Last updated: November 29, 2026
Quick Overview
Given a database's full, differential and transaction log backups, return the backup sequence that restores it to a target time, or report that the time is unreachable.
Rubrik
November 29, 20260
0
0 solved
Given a database's full, differential and transaction log backups, return the backup sequence that restores it to a target time, or report that the time is unreachable.
Rubrik protects SQL Server and Oracle with log backups so customers can recover to a specific second before an incident. The interviewer wants you to model backup dependencies, prefer the plan with the least replay, and detect gaps in the log chain instead of returning a silently wrong plan.
What the Interviewer Expects
- Model which backups depend on which
- Pick the newest usable full, then the newest diff on that full
- Verify a contiguous log chain from the restore point to the target
- Fall back to older choices when a log gap blocks the newest
- Return None rather than a plan with a gap
- Discuss complexity and test cases including exact-time targets
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How do you minimize total bytes read instead of the number of steps?
- A diff backup was taken against a full that was later expired. What happens?
- How would you expose the earliest and latest recoverable time ranges to the UI?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
A full is consistent at time. A diff is consistent at time and needs its base full. A log replays [start, end). To reach target T: restore a full (or full plus diff) with time <= T, then repla...
High-Level Design
Try fulls newest first, and for each, its diffs newest first and then no diff. For each candidate restore point, greedily extend coverage with the log that covers the current position and reaches furt...