package octez-shell-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Storage reconstruction

The storage reconstruction feature aims to re-compute the contexts (ledger state) and the blocks metadata of a full mode storage, and thus, migrate a storage from a full history mode to an archive one.

To do so, it is needed to re-validate the whole chain, by applying (using the standard validation method: Tezos_validation.Block_validation.apply) all the blocks from the genesis on empty context. As a storage running a full history mode will not store all the ledger state but keeps all the blocks (and operations), it is the only mode that can be reconstructed. The operation consist of two major steps:

  • Reconstructing the cemented block store: for each cemented cycle, the context of each block along with their associated metadatas are restored.
  • Reconstructing the floating block stores: this step is only necessary if the store was recently imported from a snapshot as some metadata will be missing.

As the reconstruction procedure changes the state of the storage, it cannot be run while a node is running on the storage to reconstruct. If the reconstruction is interrupted, it will be resumed if restarted.

type failure_kind =
  1. | Nothing_to_reconstruct
  2. | Cannot_read_block_hash of Tezos_base.TzPervasives.Block_hash.t
  3. | Cannot_read_block_level of Stdlib.Int32.t
  4. | Cannot_read_resulting_context_hash of Tezos_base.TzPervasives.Block_hash.t
type Tezos_base.TzPervasives.error +=
  1. | Reconstruction_failure of failure_kind
val reconstruct : ?patch_context: (Tezos_protocol_environment.Context.t -> Tezos_protocol_environment.Context.t Tezos_base.TzPervasives.tzresult Lwt.t) -> store_dir:string -> context_dir:string -> Tezos_base.TzPervasives.Genesis.t -> user_activated_upgrades:Tezos_base.TzPervasives.User_activated.upgrades -> user_activated_protocol_overrides: Tezos_base.TzPervasives.User_activated.protocol_overrides -> operation_metadata_size_limit: Tezos_shell_services.Shell_limits.operation_metadata_size_limit -> progress_display_mode:Tezos_stdlib_unix.Animation.progress_display_mode -> unit Tezos_base.TzPervasives.tzresult Lwt.t

reconstruct ?patch_context ~store_dir ~context_dir genesis uau uapo omsl reconstructs the storage located in store_dir and context_dir. The resulting storage will see its history mode changed to archive.

OCaml

Innovation. Community. Security.