System Design Atlas
LOCAL GUEST MODERead and practice without an account.

Your saved topics and reading progress stay in this browser. Sign in to sync supported profile and progress data.

Shard Growth 20 → 200

The cutover controller crashes between copy validation and routing activation.

● HardDrill 071 min1 prerequisite
My progress
Topic tools

Layout updated

Explore the design, then rehearse the decisions without looking.

Prompt

The cutover controller crashes between copy validation and routing activation.

Moving a is moving a live shop: copy the shelves, replay sales that happened during the move, then switch the address once.

Constraints

  • Do not lose writes or deletes during migration.
  • Keep one write owner for each data range.

Think first

Take five minutes to state the failure, the evidence you need and your first safe move.

5:00

Staged reveal

First move

A versioned routing authority owns the range assignment.

What to check

Compare durable migration state, routing and catch-up .

Recovery

Resume from a durable , keep a single write owner and validate the installed before reopening writes; do not infer completion from copied bytes alone.

What you give up

Writing to both sides needs a durable recovery log and conflict rules. Moving data also competes with foreground reads and writes, so throttle it.

Architecture and technical reference

High-level design

Growth 20 → 200
G router->old 1. old map old->copy 2. Pass validated input copy->new 3. Persist state new->cut 4. verified cut->router 5. publish new map router Consistent-Hash Router compute old RocksDB-backed KV / 20 Shards state · durable copy Migration Workers compute new RocksDB-backed KV / 200 Shards state · durable cut Cutover Controller compute
  • Compute
  • State

━━ Synchronous┄┄ Asynchronous···· Recovery / control▧ Fault

Select a component or follow a numbered connection.

Each arrow is one interaction. Request, background and recovery branches are not one linear transaction.

Read the 5 flow steps

Problem statement

Move a live dataset from 20 to 200 shards while writes continue. What proves the new owner is ready?

Functional requirements

  • Move data from existing shards to new shards.
  • Copy updates and deletes made during the move.
  • Switch requests to the new owner after verification.

Non-functional requirements

  • Do not lose writes or deletes during migration.
  • Keep one write owner for each data range.

Entities

Entity / logical owner
Authoritative state

API design

Operation / inputResponse and retry contract
Decision contractIdentify acceptance, retry identity, version/ and the response on uncertainty.

High-level design component walkthrough

Coordination / ownership

Consistent-Hash Router

+ version

Why, tradeoff and connected operations

Make ownership/version changes explicit; downstream resources must reject stale owners.

Tradeoff: Mapping version split causes misroutes

Connected operations: old map; publish new map

Distributed database

RocksDB-backed KV / 20 Shards

Read/write owner

Why, tradeoff and connected operations

Illustrative custom sharded : embedded RocksDB per ; versioned routing controls ownership. Partition durable state by the documented lookup key; consistency follows the explicit replication policy.

Tradeoff: Dual load during migration

Connected operations: old map; Pass validated input

Backend service

Migration Workers

Copy + catch up changes

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: Concurrent writes require catch-up

Connected operations: Pass validated input; Persist state

Distributed database

RocksDB-backed KV / 200 Shards

Verify copied state

Why, tradeoff and connected operations

+ log catch-up before cutover; RocksDB itself does not coordinate distributed ownership. Partition durable state by the documented lookup key; consistency follows the explicit replication policy.

Tradeoff: Need verify completeness before cutover

Connected operations: Persist state; verified

Coordination / ownership

Cutover Controller

ownership

Why, tradeoff and connected operations

Make ownership/version changes explicit; downstream resources must reject stale owners.

Tradeoff: / rollback complexity

Connected operations: verified; publish new map

Engineering control room

Deep dives — decisions, failures and recovery

Open a deep dive to follow the steps, try an example and see how recovery works.

Deep dive 1

Know which shard is allowed to write

A versioned routing authority owns the range assignment.

Read the explanation and worked example
How it works

The routing authority stores a placement identifying the allowed write owner for each range. Migration workers track a consistent and how far mutation replay has progressed. Copies of data do not acquire ownership merely by existing on a target .

Walk through an example

Both old and new shards contain key K after copying. If clients can choose either for writes, two histories start before the cutover is even declared.

Failure and recovery

Validate the on requests and keep migration state durable. A stale routing cache must receive a redirect or rejection rather than permission to write through the old owner.

Why this helps

Having a copied file does not make the target a writer, and a cached old route does not authorize the source after cutover.

What you give up

Writing to both sides needs a durable recovery log and conflict rules. Moving data also competes with foreground reads and writes, so throttle it.

Deep dive 2

Copy, catch up and then switch ownership

Replay updates and deletes to a checked position before publishing the new owner.

Read the explanation and worked example
How it works

Copy a consistent source , then replay mutations and deletes made after that . Verify a catch-up and use a controlled handoff or brief write barrier to establish the cutover boundary. Publish the new placement only after the target is ready to own that history.

Walk through an example

The copier reaches the end of its file while new writes are still arriving. Completed bytes are not evidence that the target contains every mutation required for safe cutover.

Failure and recovery

Resume from recorded checkpoints after a crash and retain old data through the rollback/safety window. Test writes and deletes immediately before, during and after ownership transfer.

Why this helps

A bulk-copy job can finish while recent writes are still missing from the target.

What you give up

Redirect or reject stale clients. If rollback is needed after new writes, reconcile them first; simply changing the pointer can lose accepted updates.

Deep dive 3

What happens if a region fails?

Recover the current owner before continuing a partially completed move.

Read the explanation and worked example
How it works

Treat migration ownership and regional promotion as changes to the same versioned placement authority. Persist /catch-up checkpoints remotely according to the recovery promise; a target copy is not an authorized writer until a valid cutover.

Walk through an example

A region fails halfway through migrating a range to the new set.

Failure and recovery

Recover the last committed placement , resume verified transfer state and fence obsolete migration controllers before moving ownership again.

Why this helps

Data movement and failover must agree about which copy may accept writes.

What you give up

Keeping old copies longer improves recovery options but increases storage and deletion-safety work.

Deep dive 4

Check a moved shard before switching traffic

Verify logical state and deletion coverage before declaring migration complete.

Read the explanation and worked example
How it works

Compare source and target data at an agreed /catch-up boundary, including versions and deletes. Track per-range transfer checksums and durable progress rather than only copied bytes. Keep old owners fenced but available as recovery evidence through a defined safety window.

Walk through an example

The target contains the expected row count but is missing a recent delete and contains an extra stale value. Row-count equality alone cannot prove a safe migration.

Failure and recovery

Stop cutover for the affected range, replay missing mutations and revalidate. Rollback requires reconciling writes accepted after cutover; changing a routing pointer alone can lose them.

Why this helps

Migration correctness is about one complete logical history, not a successful bulk-copy job.

What you give up

Longer validation and old-copy increase time/storage cost but reduce difficult post-cutover data loss.

Tradeoffs and alternatives

DecisionTradeoff / alternative and recovery implication
Know which is allowed to writeWriting to both sides needs a durable recovery log and conflict rules. Moving data also competes with foreground reads and writes, so throttle it.
Copy, catch up and then switch ownershipRedirect or reject stale clients. If rollback is needed after new writes, reconcile them first; simply changing the pointer can lose accepted updates.
What happens if a region fails?Keeping old copies longer improves recovery options but increases storage and deletion-safety work.
Check a moved before switching trafficLonger validation and old-copy increase time/storage cost but reduce difficult post-cutover data loss.

Production scars & failure modes

Failure investigation

The cutover controller crashes between copy validation and routing activation.

Look for: Compare durable migration state, routing and catch-up .

Recovery and invariant: Resume from a durable , keep a single write owner and validate the installed before reopening writes; do not infer completion from copied bytes alone.

Component / failureImpactRecovery mechanismAlternative / tradeoff
Primary failure / raceMove a live dataset from 20 to 200 shards while writes continue. What proves the new owner is ready?Copy a consistent , replay mutations/deletes to a verified , then publish a fenced cutover. Keep old copies through the safety window.Dual-writing without a recoverable log creates partial success. Rebalancing consumes foreground I/O and needs throttling.
Recovery follow-upA stale client writes to the old owner after cutover; then the new fails. Define redirection, and a safe rollback.Copy a consistent , replay mutations/deletes to a verified , then publish a fenced cutover. Keep old copies through the safety window.State the guarantee you relax and how you detect recovery.

90-second interview summary

For growth, I would distinguish copying data from transferring write authority. A versioned placement service identifies the current owner of each range. Migration workers record a consistent and durable progress through the mutations that arrive while the is copied.

The target receives the , then replays updates and deletes to a verified catch-up boundary. Checksums, version coverage and deletion state matter; matching row counts or copied-byte totals do not prove that the target has the required logical history.

Cutover establishes a fenced new placement under a controlled handoff. Old routing caches receive redirects or rejections rather than permission to continue writing to the old owner. A crashed controller resumes from durable migration state instead of inferring completion from files on disk.

I would retain old data through a safety window, but rollback after new writes also needs ; a pointer change alone can lose accepted updates. Regional promotion must use the same placement authority. Metrics include oldest transfer lag, validation errors and stale- writes. The tradeoff is temporary duplicate storage and careful cutover coordination in exchange for growing from 20 to 200 logical shards without dual owners or lost deletes.

Explain it without looking

Explain know which is allowed to write

Reveal answer

A versioned routing authority owns the range assignment.

Having a copied file does not make the target a writer, and a cached old route does not authorize the source after cutover.

Writing to both sides needs a durable recovery log and conflict rules. Moving data also competes with foreground reads and writes, so throttle it.

Explain copy, catch up and then switch ownership

Reveal answer

Replay updates and deletes to a checked position before publishing the new owner.

A bulk-copy job can finish while recent writes are still missing from the target.

Redirect or reject stale clients. If rollback is needed after new writes, reconcile them first; simply changing the pointer can lose accepted updates.

Explain what happens if a region fails?

Reveal answer

Recover the current owner before continuing a partially completed move.

Data movement and failover must agree about which copy may accept writes.

Keeping old copies longer improves recovery options but increases storage and deletion-safety work.

Explain check a moved before switching traffic

Reveal answer

Verify logical state and deletion coverage before declaring migration complete.

Migration correctness is about one complete logical history, not a successful bulk-copy job.

Longer validation and old-copy increase time/storage cost but reduce difficult post-cutover data loss.

Revision checklist

Revision checklist

  • Reconstruct know which is allowed to write: A versioned routing authority owns the range assignment.
  • Reconstruct copy, catch up and then switch ownership: Replay updates and deletes to a checked position before publishing the new owner.
  • Reconstruct what happens if a region fails?: Recover the current owner before continuing a partially completed move.
  • Reconstruct check a moved before switching traffic: Verify logical state and deletion coverage before declaring migration complete.
  • Name the authoritative state, boundary, retry identity and failure-domain durability guarantee.
  • Explain one alternative and exactly which guarantee you would relax.
  • Redraw the request and recovery paths without looking; mark what required a hint.

On this page
  1. Prompt
  2. Constraints
  3. Think first
  4. Staged reveal
  5. High-level design
  6. Problem statement
  7. Functional requirements
  8. Non-functional requirements
  9. Entities
  10. API design
  11. High-level design component walkthrough
  12. Engineering control room
  13. Deep dives — decisions, failures and recovery
  14. Tradeoffs and alternatives
  15. Production scars & failure modes
  16. 90-second interview summary
  17. Explain it without looking
  18. Revision checklist

Save & sync your Atlas progress

Sync your profile and topic progress across browsers, then return to the same study desk.

Google sign-in will appear here after its Azure provider is configured.

Architecture diagram