Expansion And Rebalance
D1 Plus can convert a deployed logical store from one supported shard layout to
another by changing capacity.targetShardCount. For example, a store can move
from 1 shard to 2, 4, 8, 16, 32, or 64 shards while application
code keeps using the same logical database surface.
Deploy Preparation
Section titled “Deploy Preparation”During deploy, Layeron compares the applied D1 Plus store with the new desired
store. When the desired target shard count is larger, Layeron prepares a target
routing manifest and a layeron.d1_plus.expansion resource. The target
manifest starts in a prepared phase until the expansion flow completes.
During the conversion window:
- Reads can fan out across source and target routes to preserve correctness.
- Writes stay source-primary and shadow to the target route.
- The target manifest records required bindings and schema version.
- Cleanup keeps source rows during the grace window.
Production Expansion
Section titled “Production Expansion”Production expansion is a Product capability boundary. It is coordinated through deployment state and the D1 Plus resource graph:
- Create target shards.
- Apply schema to target shards.
- Copy rows idempotently.
- Validate parity.
- Activate the target routing manifest.
- Retire source cleanup after the grace window.
This keeps expansion tied to deployment records and avoids treating shard movement as an untracked runtime side effect.