Mavryk_store_unix_reconstruction.Reconstruction
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: Mavryk_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:
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 =
| Nothing_to_reconstruct
| Cannot_read_block_hash of Mavryk_base.TzPervasives.Block_hash.t
| Cannot_read_block_level of Stdlib.Int32.t
| Cannot_read_resulting_context_hash of Mavryk_base.TzPervasives.Block_hash.t
val reconstruct :
?patch_context:
(Mavryk_protocol_environment.Context.t ->
Mavryk_protocol_environment.Context.t Mavryk_base.TzPervasives.tzresult
Lwt.t) ->
store_dir:string ->
context_dir:string ->
Mavryk_base.TzPervasives.Genesis.t ->
user_activated_upgrades:Mavryk_base.TzPervasives.User_activated.upgrades ->
user_activated_protocol_overrides:
Mavryk_base.TzPervasives.User_activated.protocol_overrides ->
operation_metadata_size_limit:
Mavryk_shell_services.Shell_limits.operation_metadata_size_limit ->
progress_display_mode:Mavryk_stdlib_unix.Animation.progress_display_mode ->
unit Mavryk_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.