Bedrock.ControlPlane.Director.Recovery.LogRecoveryPlanningPhase (bedrock v0.6.0)
View SourceDetermines which logs from the previous layout should be copied to preserve committed transactions, and establishes the minimum durable version across all logs.
Runs when logs existed in the previous layout. Uses simple majority quorum - if more than half
of the logs from the previous layout are available (locked), recovery can proceed. The version
vector is computed as {max(available_after), min(last_inclusive)} across
all available logs. Its lower element is an exclusive cursor, not the first
retained transaction.
Also calculates durable_version as the minimum of all logs' minimum_durable_version values,
representing the highest version guaranteed to be persisted to durable storage (ObjectStorage)
via Demux across all logs.
With consistent hashing, shard→log mapping is computed (not stored), so per-shard quorum validation is no longer needed. Replacement logs can reconstruct their personalized transaction stream by pulling from all survivors and filtering by the shard index embedded in transactions.
Stalls with :unable_to_meet_log_quorum if majority quorum cannot be established
or no valid version range exists.
Transitions to log recruitment with the selected logs, version vector, and durable version.
Summary
Functions
Calculates the minimum durable version across all logs.
Computes the version vector from log recovery info.
Validates an exclusive/inclusive recovery range (available_after <= last_inclusive).
Functions
@spec calculate_durable_version(%{ required(Bedrock.DataPlane.Log.id()) => Bedrock.DataPlane.Log.recovery_info() }) :: Bedrock.version()
Calculates the minimum durable version across all logs.
Takes the minimum of all available minimum_durable_version values from
log recovery info. Returns Version.zero() if no logs have durability info.
@spec compute_version_vector(%{ required(Bedrock.DataPlane.Log.id()) => Bedrock.DataPlane.Log.recovery_info() }) :: {:ok, Bedrock.version_vector()} | {:error, :invalid_version_range}
Computes the version vector from log recovery info.
Returns {max(available_after), min(last_inclusive)} across all logs, which
represents the common recovery range (available_after, last_inclusive].
@spec valid_range?(Bedrock.version_vector()) :: boolean()
Validates an exclusive/inclusive recovery range (available_after <= last_inclusive).