Expire a Middle Snapshot in an Incremental-Forever Chain
Last updated: November 29, 2026
Quick Overview
Snapshots are stored as one full image followed by block-level deltas. Implement expiring any snapshot except the newest so every remaining version still restores to exactly the same data.
Rubrik
November 29, 20260
0
0 solved
Snapshots are stored as one full image followed by block-level deltas. Implement expiring any snapshot except the newest so every remaining version still restores to exactly the same data.
Rubrik's incremental-forever model means expiry is not a delete: the expired snapshot's blocks may still be needed by its successors. The interviewer is checking that you reason about which side wins in a merge, treat the base snapshot as a special case, and verify with a restore-equality test.
What the Interviewer Expects
- Represent full and delta snapshots clearly
- Merge the expired delta into its successor with newer blocks winning
- Handle expiring the base full snapshot
- Refuse to expire the newest snapshot (or explain why)
- Prove correctness by comparing materialized images before and after
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
- Merging into the successor rewrites data. How would you make it crash-safe?
- Restoring the newest version now replays a long chain. When would you synthesize a new full?
- How would you do this when blocks are content-addressed chunks with reference counts?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
chain[0] is {block: data} for the whole disk; chain[i] holds only blocks changed since chain[i-1]. After expire(chain, i), every version other than i must materialize to the same image as be...
High-Level Design
Version i+1 was defined relative to i. If i disappears, i+1 must absorb whatever i changed that i+1 did not overwrite. So merged = delta_i updated with delta_{i+1}. If i is the base, the...