Interview prompt
Problem context
Skills being evaluated
Use the sequence below to surface constraints, choose boundaries, test failure behavior, and defend trade-offs. Concrete numbers are interview assumptions, not claims about a real production system.
Clarify the decision
- Define the shard’s write authority, maximum tolerated pause, acceptable replication lag, and whether clients can retry across an ownership change. Ask which state is derivable and which must be transferred exactly.
Establish scale assumptions
- Assume multi-terabyte shards, sustained writes during copy, and network headroom limited to a safe fraction of regional bandwidth. Model move duration and log growth together; a snapshot that copies slower than mutations accumulate never converges.
Functional and non-functional requirements
- Maintain a single fenced writer, preserve acknowledged writes, bound request disruption, verify state before promotion, and allow the controller to resume safely after crashing at any step.
High-level architecture
- A strongly consistent placement controller issues monotonically increasing ownership epochs. The destination copies a snapshot, tails the source change log, catches up, then promotion atomically changes routing and fences the source before the destination serves writes.
Data model and flow
- Record a snapshot position, copy checksummed ranges, stream later mutations idempotently, and maintain a high-water mark. After routing cutover, forward or reject straggler requests carrying the old epoch rather than applying them locally.
Consistency and transaction boundaries
- Every mutating request and storage commit includes the current ownership epoch. Promotion requires a conditional compare-and-swap in the placement store; no amount of wall-clock timing can substitute for fencing.
Failure modes and recovery
- Make each move phase durable and idempotent: planned, snapshotting, catching up, fenced, promoted, verified, cleaned. A failure before fencing restarts or abandons the destination; after fencing, rollback requires a new epoch and reverse catch-up, never re-enabling the old writer casually.
Security and privacy
- Authenticate the controller and transfer channel, encrypt state in motion, and scope operators to particular clusters and tenants. Cleanup must honor retention and ensure abandoned destination copies do not become forgotten sensitive-data replicas.
Observability and SLOs
- Expose bytes copied, mutation lag, checksum mismatch, throttling, epoch rejects, request redirects, and phase duration per move. Alert when a move cannot converge or consumes its network error budget.
Capacity and cost
- Throttle copies against foreground latency and reserve temporary double storage. Schedule moves in parallel only across independent failure domains, and use virtual shards to make future movements smaller.
Alternatives and trade-offs
- Stop-the-world moves are simpler but violate availability at large sizes. Dual-write moves seem faster but create a difficult equality problem; snapshot-plus-log with fenced ownership provides one authoritative write path throughout.
Evolution and migration
- Add epochs and request fencing before automating any movement. Rehearse on read-only or replica moves, compare checksums, then enable small production shards and progressively increase size and concurrency.
What Staff and Principal candidates should emphasize
- The decisive signals are a monotonic authority epoch, durable move state machine, foreground throttling, and honest rollback after promotion. Principal candidates also discuss controller failure and future shard granularity.
Decision trade-offs
Transfer method
Option A
Snapshot plus ordered change-log catch-up
Option B
Application dual-writes to source and destination
Recommendation:Prefer snapshot plus log because one writer remains authoritative; dual-write requires a much harder divergence and repair protocol.
Cutover timing
Option A
Brief bounded write drain
Option B
Fully live forwarding during ownership swap
Recommendation:Use a short drain when the SLO permits because it simplifies proof; otherwise use epoch-aware forwarding and accept greater routing complexity.
Follow-up interview questions
- 01What happens if the destination never catches up because the source write rate is too high?
- 02How does rollback work after the old owner has been fenced?
- 03How do clients learn the new owner without a synchronized cache flush?
- 04What prevents two controller instances from promoting different destinations?
Common weak answers and mistakes
- 01Using lease expiry alone instead of fencing stale writers at commit time.
- 02Starting cleanup immediately after cutover without a verification and rollback window.
- 03Ignoring foreground latency and saturating the network with snapshot copies.
- 04Calling dual-write safe without a divergence detector and reconciliation owner.
Interviewer evaluation rubric
Copies data and flips routing but cannot prevent stale source writes or recover a controller crash.
Uses snapshot plus log catch-up, a controlled cutover, checksums, and basic rollback stages.
Adds ownership epochs, durable idempotent phases, foreground throttling, straggler handling, and post-cutover verification.
Proves single-writer authority through every failure, distinguishes pre- and post-fence rollback, and evolves shard granularity safely.