Problem Statement
Outline an end-to-end plan to double shards from 64 to 128 without downtime.
Explanation
Introduce a shard-map v2 that maps old slots to new slots (e.g., power-of-two expansion). Start dual writes and begin backfilling data to new shards in batches with throttling. Validate parity by sampling reads from both targets.
Switch reads per-tenant or per-bucket using flags. Monitor error rates and lag. Once stable, disable writes to old slots, run a final delta sync, and decommission. Keep rollback by retaining old data and routing map until confidence is high.
Code Solution
SolutionRead Only
slot = hash(key) & 127 // from & 63 to & 127; router supports v1|v2
