Bedrock.DataPlane.Log.Shale.Recovery (bedrock v0.6.0)

View Source

Recovery logic for Shale log servers.

Every log stores the same encoded transaction stream. Recovery pulls from one available survivor, appends each source binary unchanged, and lets the fresh destination Demux perform normal shard slicing.

Summary

Functions

Tears down the previous Demux incarnation (synchronously, so no stale buffer or in-flight flush can write a chunk afterward) and starts a fresh one. The durability floor resets to nil: it re-derives from fresh confirmations only, pinning trim at the recovery durable version until the replayed range re-confirms.

Functions

abort_all_pending_pushes(t)

abort_all_waiting_pullers(t)

close_writer(t)

discard_all_segments(t)

discard_segments(segment_recycler, list)

@spec discard_segments(term(), [Bedrock.DataPlane.Log.Shale.Segment.t()]) :: []
@spec discard_segments(term(), [Bedrock.DataPlane.Log.Shale.Segment.t()]) :: []

pull_transactions(t, log_ref, replay_after, last_inclusive)

@spec pull_transactions(
  t :: Bedrock.DataPlane.Log.Shale.State.t(),
  log_ref :: Bedrock.DataPlane.Log.ref(),
  replay_after :: Bedrock.version(),
  last_inclusive :: Bedrock.version()
) ::
  {:ok, Bedrock.DataPlane.Log.Shale.State.t()}
  | {:error, term(), Bedrock.DataPlane.Log.Shale.State.t()}

pull_transactions_from_sources(t, source_logs, replay_after, last_inclusive)

@spec pull_transactions_from_sources(
  t :: Bedrock.DataPlane.Log.Shale.State.t(),
  source_logs :: [Bedrock.DataPlane.Log.ref()],
  replay_after :: Bedrock.version(),
  last_inclusive :: Bedrock.version()
) ::
  {:ok, Bedrock.DataPlane.Log.Shale.State.t()}
  | {:error, term(), Bedrock.DataPlane.Log.Shale.State.t()}

recover_from(t, source_logs, replay_after, last_inclusive)

@spec recover_from(
  Bedrock.DataPlane.Log.Shale.State.t(),
  source_logs :: [Bedrock.DataPlane.Log.ref()],
  replay_after :: Bedrock.version(),
  last_inclusive :: Bedrock.version()
) ::
  {:ok, Bedrock.DataPlane.Log.Shale.State.t()}
  | {:error, term(), Bedrock.DataPlane.Log.Shale.State.t()}

reset_demux(t)

Tears down the previous Demux incarnation (synchronously, so no stale buffer or in-flight flush can write a chunk afterward) and starts a fresh one. The durability floor resets to nil: it re-derives from fresh confirmations only, pinning trim at the recovery durable version until the replayed range re-confirms.

States without an object storage backend (segment-only unit tests) are left untouched.