Bedrock.ControlPlane.Director.Recovery.MaterializerBootstrapPhase (bedrock v0.7.0)
View SourceBootstraps the metadata shard materializer for recovery.
The metadata materializer holds the authoritative shard layout - the mapping from key ranges to shard tags. This phase ensures the materializer is available and queries it for the current shard layout.
Fresh Cluster
For a fresh cluster (no old logs), creates a default shard layout with two shards:
- System shard (tag 0): Keys from 0xFF to end-of-keyspace (system metadata)
- User shard (tag 1): Keys from empty string to 0xFF (user data)
Existing Cluster
For an existing cluster:
- Resolve the system materializer BY NAME from the prior core state — it is looked up, never invented (bedrock-q67.21.12)
- Lock it for recovery
- Unlock it with its replica set of pull sources to start pulling
- Wait for it to catch up (60s timeout)
- Query the shard layout from
\xff/system/shard_keys/*
Stalls if the named members are unavailable, if catchup times out, or if the recovered layout reads empty. Records written before the core state carried system materializers take a one-time migration: recovery adopts the sole locked worker claiming tag 0, and refuses to choose when several do (bedrock-q67.21.21).
Transitions to CommitProxyStartupPhase with the materializer pid and shard layout.
Summary
Functions
Returns the default shard layout for a fresh cluster.
Functions
@spec default_shard_layout() :: Bedrock.ControlPlane.Config.RecoveryAttempt.shard_layout()
Returns the default shard layout for a fresh cluster.
Layout has two shards:
- Tag 0: System keys (0xFF to end_of_keyspace)
- Tag 1: User keys (empty string to 0xFF)
The map is keyed by end_key, with values of {tag, start_key}.