From ed40e99bcdc4e985c8bfc927fccdb3d984b83ad0 Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Mon, 30 Jan 2023 10:49:20 +0100 Subject: [PATCH 1/3] Store: disable snapshot export for the always indexing strategy --- src/lib_store/unix/snapshots.ml | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/lib_store/unix/snapshots.ml b/src/lib_store/unix/snapshots.ml index a597a9f2797c..f902ef9273d9 100644 --- a/src/lib_store/unix/snapshots.ml +++ b/src/lib_store/unix/snapshots.ml @@ -90,6 +90,7 @@ type error += | Inconsistent_imported_block of Block_hash.t * Block_hash.t | Wrong_snapshot_file of {filename : string} | Invalid_chain_store_export of Chain_id.t * string + | Cannot_export_snapshot_format let () = let open Data_encoding in @@ -576,7 +577,22 @@ let () = Some (chain_id, store_dir) | _ -> None) (fun (chain_id, store_dir) -> - Invalid_chain_store_export (chain_id, store_dir)) + Invalid_chain_store_export (chain_id, store_dir)) ; + register_error_kind + `Permanent + ~id:"Snapshot.cannot_export_snapshot_format" + ~title:"Cannot export snapshot format" + ~description:"Cannot export snapshot format" + ~pp:(fun ppf () -> + Format.fprintf + ppf + "Cannot export snapshot with a storage that was created with Octez v13 \ + (or earlier). Please refer to the documentation and consider \ + switching to the default minimal indexing strategy to enable snapshot \ + exports. ") + unit + (function Cannot_export_snapshot_format -> Some () | _ -> None) + (fun () -> Cannot_export_snapshot_format) (* This module handles snapshot's versioning system. *) module Version = struct @@ -2500,12 +2516,15 @@ module Make_snapshot_exporter (Exporter : EXPORTER) : Snapshot_exporter = struct let export_context snapshot_exporter ~context_dir context_hash = let open Lwt_result_syntax in let*! context_index = Context.init ~readonly:true context_dir in - Animation.three_dots ~progress_display_mode:Auto ~msg:"Exporting context" - @@ fun () -> - Lwt.finalize - (fun () -> - Exporter.export_context snapshot_exporter context_index context_hash) - (fun () -> Context.close context_index) + let is_gc_allowed = Context.is_gc_allowed context_index in + if not is_gc_allowed then tzfail Cannot_export_snapshot_format + else + Animation.three_dots ~progress_display_mode:Auto ~msg:"Exporting context" + @@ fun () -> + Lwt.finalize + (fun () -> + Exporter.export_context snapshot_exporter context_index context_hash) + (fun () -> Context.close context_index) let export_rolling snapshot_exporter ~store_dir ~context_dir ~block ~rolling genesis = -- GitLab From d24add043e56ea412eac3d466c24ed4b341813f0 Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Mon, 30 Jan 2023 10:50:07 +0100 Subject: [PATCH 2/3] Changelog: disable snapshot export for the always indexing strategy --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 5a07082aa88a..b4ccad1d9e5d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -38,6 +38,9 @@ Node - Fixed a bug while reconstructing the storage after a snapshot import that would result in wrong context hash mapping for some blocks. +- **Breaking Change**: disabled snapshot export support for storage + that was created with Octez v13 (or earlier). + Client ------ -- GitLab From d92303a729d47f8f1e6408e455165f25fdca5d6e Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Fri, 27 Jan 2023 11:16:06 +0100 Subject: [PATCH 3/3] Changelog: gc and split callback only if allowed --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index b4ccad1d9e5d..845cfe534d9f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -41,6 +41,9 @@ Node - **Breaking Change**: disabled snapshot export support for storage that was created with Octez v13 (or earlier). +- Fixed a bug raising an error when a context split was called on a + context that was created with Octez v13 (or earlier). + Client ------ -- GitLab