Bedrock.ControlPlane.Director.Recovery.MaterializerBootstrapPhase (bedrock v0.5.2)
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:
- Find materializer with shard_id = 0 (system shard) in available_services
- If not found, create a new materializer on a capable node
- Lock materializer for recovery
- Unlock it with system shard logs to start pulling
- Wait for materializer to catch up (60s timeout)
- Query shard layout from
\xff/system/shard_keys/*
Stalls if the materializer is unavailable and cannot be created, or if catchup times out. 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}.