Director

View Source

The Director is Bedrock's recovery orchestrator, serving as the singular authority for rebuilding the distributed transaction system after failures. Created by the Coordinator, it manages multi-phase service restoration, dependency sequencing, and ensures only one recovery process operates through epoch-based authority.

Location: lib/bedrock/control_plane/director.ex

Epoch-Based Authority

Each Director receives a unique, monotonically increasing epoch number that determines recovery authority. Higher epochs win when multiple Directors exist, preventing split-brain scenarios. This eliminates complex distributed consensus during recovery when coordination infrastructure may be compromised.

When Coordinator leadership changes during recovery, the new Coordinator creates a Director with a higher epoch, automatically superseding existing recovery processes.

Recovery Orchestration

Director executes multi-phase recovery addressing component dependencies. See the Overview or the Deep Dive.

Service Lifecycle Management

Director manages service creation and replacement through the use of local Foreman on participating nodes. Placement decisions balance fault tolerance, network topology, and node capabilities to maximize reliability while minimizing recovery time.

Health monitoring tracks functional capability of each component, ensuring services can perform their designated transaction system roles.

  • Coordinator: Creates and manages Director lifecycle with epoch assignment
  • Foreman: Infrastructure component that creates workers under Director coordination
  • Log: Critical data plane component requiring Director-managed recovery sequencing
  • Storage: Data plane component with complex dependency requirements during recovery