Implement Snapshot Isolation for Shared Reminders List Edits
Last updated: November 29, 2026
Quick Overview
Implement a multi-version key-value store with snapshot isolation where concurrent transactions read a consistent snapshot and the second writer to commit a conflicting key is aborted.
Apple
November 29, 20260
0
0 solved
Implement a multi-version key-value store with snapshot isolation where concurrent transactions read a consistent snapshot and the second writer to commit a conflicting key is aborted.
Shared Reminders and Notes lists are edited from several devices and family members at once, and the backend must not silently lose an edit. The interviewer checks MVCC internals, first-committer-wins validation, atomic commit, and awareness of anomalies snapshot isolation still allows.
What the Interviewer Expects
- Keeps a version chain per key with commit timestamps
- Reads at the transaction's start timestamp and returns its own uncommitted writes
- Validates write-write conflicts and installs writes atomically under one critical section
- Explains write skew and how serializable snapshot isolation or explicit locks fix it
- Discusses garbage collection of old versions
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Give an example of write skew in a Reminders feature and how you would prevent it.
- How would you garbage-collect versions no active transaction can see?
- How would this change in a distributed store with clocks on many nodes?
- Should the client retry automatically on conflict, or merge the edits?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
begin()takes a snapshot timestamp.getsees committed data as of that snapshot plus the transaction's own writes.commitaborts if any written key was committed by someone else after the ...
High-Level Design
Each key maps to a list of (commit_ts, value) in ascending order. A global logical clock advances on each commit. Writes buffer in the transaction. Commit takes the store lock, checks each written k...