diff --git a/src/bin_node/node_run_command.ml b/src/bin_node/node_run_command.ml index b990ca8cc7865b67c55d177357a2562ded69c2e4..0837e2b8e9fc356cfcf4e6cd061ce74ba9f6564f 100644 --- a/src/bin_node/node_run_command.ml +++ b/src/bin_node/node_run_command.ml @@ -369,7 +369,7 @@ let init_node ?sandbox ?target ~identity ~singleprocess ~internal_events Node.create ~sandboxed:(sandbox <> None) ?sandbox_parameters:(Option.map snd sandbox_param) - ?context_pruning:config.shell.context_pruning + ?disable_context_pruning:config.shell.disable_context_pruning ~singleprocess ~version ~commit_info diff --git a/src/lib_node_config/config_file.ml b/src/lib_node_config/config_file.ml index d74d89e684439328bc9d616cc3f706848e106989..ba9c8e797b7625ba15251d5212d5110559524bdf 100644 --- a/src/lib_node_config/config_file.ml +++ b/src/lib_node_config/config_file.ml @@ -918,7 +918,8 @@ let update ?(disable_config_validation = false) ?data_dir ?min_connections ?(enable_testchain = default_p2p.enable_testchain) ?(cors_origins = []) ?(cors_headers = []) ?rpc_tls ?log_output ?log_coloring ?synchronisation_threshold ?history_mode ?network ?latency - ?enable_http_cache_headers ?context_pruning ?storage_maintenance_delay cfg = + ?enable_http_cache_headers ?disable_context_pruning + ?storage_maintenance_delay cfg = let open Lwt_result_syntax in let disable_config_validation = cfg.disable_config_validation || disable_config_validation @@ -1044,8 +1045,10 @@ let update ?(disable_config_validation = false) ?data_dir ?min_connections in {synchronisation}); history_mode = Option.either history_mode cfg.shell.history_mode; - context_pruning = - Option.either context_pruning cfg.shell.context_pruning; + disable_context_pruning = + Option.either + disable_context_pruning + cfg.shell.disable_context_pruning; storage_maintenance_delay = Option.either storage_maintenance_delay diff --git a/src/lib_node_config/config_file.mli b/src/lib_node_config/config_file.mli index f108669c3eb8266a8065bd92f3243b8722bb7fec..f8abc0c5ea5b3cb4c543d4667afc4f5f3baca6c9 100644 --- a/src/lib_node_config/config_file.mli +++ b/src/lib_node_config/config_file.mli @@ -143,7 +143,7 @@ val update : ?network:blockchain_network -> ?latency:int -> ?enable_http_cache_headers:bool -> - ?context_pruning:Storage_maintenance.context_pruning -> + ?disable_context_pruning:bool -> ?storage_maintenance_delay:Storage_maintenance.delay -> t -> t tzresult Lwt.t diff --git a/src/lib_node_config/shared_arg.ml b/src/lib_node_config/shared_arg.ml index 8d081f83266eddb603bab1357d9d6f65f6b77df8..a1b078dc707aec2bedd46c5ea447e3051ce5c9b4 100644 --- a/src/lib_node_config/shared_arg.ml +++ b/src/lib_node_config/shared_arg.ml @@ -72,7 +72,7 @@ type t = { operation_metadata_size_limit : Shell_limits.operation_metadata_size_limit option; enable_http_cache_headers : bool option; - context_pruning : Storage_maintenance.context_pruning option; + disable_context_pruning : bool option; storage_maintenance_delay : Storage_maintenance.delay option; } @@ -195,7 +195,8 @@ let wrap data_dir config_file network connections max_download_speed log_coloring history_mode synchronisation_threshold latency disable_config_validation allow_all_rpc media_type max_active_rpc_connections metrics_addr operation_metadata_size_limit - enable_http_cache_headers context_pruning storage_maintenance_delay = + enable_http_cache_headers disable_context_pruning storage_maintenance_delay + = let actual_data_dir = Option.value ~default:Config_file.default_data_dir data_dir in @@ -210,6 +211,9 @@ let wrap data_dir config_file network connections max_download_speed let enable_http_cache_headers = if enable_http_cache_headers then Some true else None in + let disable_context_pruning = + if disable_context_pruning then Some true else None + in { disable_config_validation; data_dir; @@ -248,7 +252,7 @@ let wrap data_dir config_file network connections max_download_speed metrics_addr; operation_metadata_size_limit; enable_http_cache_headers; - context_pruning; + disable_context_pruning; storage_maintenance_delay; } @@ -759,24 +763,9 @@ module Term = struct let doc = "Enables HTTP cache headers in the RPC response" in Arg.(value & flag & info ~docs ~doc ["enable-http-cache-headers"]) - let context_pruning = - let open Storage_maintenance in - let doc = - "Configures whether or not the storage maintenance of the context should \ - be enabled" - in - let parse str = - match str with - | "disabled" -> `Ok (Disabled : Storage_maintenance.context_pruning) - | "enabled" -> `Ok Enabled - | _ -> - `Error - "context-pruning only supports \"disabled\" and \"enabled\" modes" - in - Arg.( - value - & opt (some (parse, pp_context_pruning)) None - & info ~docs ~doc ["context-pruning"]) + let disable_context_pruning = + let doc = "Disables the storage maintenance of the context" in + Arg.(value & flag & info ~docs ~doc ["disable-context-pruning"]) let storage_maintenance_delay = let open Storage_maintenance in @@ -814,7 +803,8 @@ module Term = struct $ log_output $ log_coloring $ history_mode $ synchronisation_threshold $ latency $ disable_config_validation $ allow_all_rpc $ media_type $ max_active_rpc_connections $ metrics_addr $ operation_metadata_size_limit - $ enable_http_cache_headers $ context_pruning $ storage_maintenance_delay + $ enable_http_cache_headers $ disable_context_pruning + $ storage_maintenance_delay end let read_config_file args = @@ -963,7 +953,7 @@ let patch_config ?(may_override_network = false) ?(emit = Event.emit) metrics_addr; operation_metadata_size_limit; enable_http_cache_headers; - context_pruning; + disable_context_pruning; storage_maintenance_delay; } = args @@ -1123,7 +1113,7 @@ let patch_config ?(may_override_network = false) ?(emit = Event.emit) ?history_mode ?latency ?enable_http_cache_headers - ?context_pruning + ?disable_context_pruning ?storage_maintenance_delay cfg diff --git a/src/lib_node_config/shared_arg.mli b/src/lib_node_config/shared_arg.mli index bf933ce7060a7a0134f0e4a426f035c37458cd37..f549d1529391b1709ed74a89e0fecd46a6f55a7b 100644 --- a/src/lib_node_config/shared_arg.mli +++ b/src/lib_node_config/shared_arg.mli @@ -90,7 +90,7 @@ type t = { enable_http_cache_headers : bool option; (** Adds Cache-control header directives to RPC responses for queries that are relative to the head block. *) - context_pruning : Storage_maintenance.context_pruning option; + disable_context_pruning : bool option; storage_maintenance_delay : Storage_maintenance.delay option; } diff --git a/src/lib_shell/node.ml b/src/lib_shell/node.ml index 21ae4e0f558348da2f3fb1b5918c7adf3c0877d0..dd68e35915eb9e166f98d798035fcefcd127408c 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -200,8 +200,8 @@ let check_context_consistency store = tzfail Non_recoverable_context let create ?(sandboxed = false) ?sandbox_parameters - ?(context_pruning = Storage_maintenance.Enabled) ?history_mode - ?maintenance_delay ~singleprocess ~version ~commit_info + ?(disable_context_pruning = false) ?history_mode ?maintenance_delay + ~singleprocess ~version ~commit_info { genesis; chain_name; @@ -253,7 +253,7 @@ let create ?(sandboxed = false) ?sandbox_parameters ~context_dir:context_root ~allow_testchains:start_testchain ~readonly:false - ~context_pruning + ~disable_context_pruning ?maintenance_delay genesis in @@ -295,7 +295,7 @@ let create ?(sandboxed = false) ?sandbox_parameters ~context_dir:context_root ~allow_testchains:start_testchain ~readonly:false - ~context_pruning + ~disable_context_pruning ?maintenance_delay genesis in diff --git a/src/lib_shell/node.mli b/src/lib_shell/node.mli index 9ff6e8e77c8d264424a73d64099c6c85007175d8..c4fe6ca7ad75d47e19bb6abef7dc239055fd3cdc 100644 --- a/src/lib_shell/node.mli +++ b/src/lib_shell/node.mli @@ -39,7 +39,7 @@ type config = { val create : ?sandboxed:bool -> ?sandbox_parameters:Data_encoding.json -> - ?context_pruning:Storage_maintenance.context_pruning -> + ?disable_context_pruning:bool -> ?history_mode:History_mode.t -> ?maintenance_delay:Storage_maintenance.delay -> singleprocess:bool -> diff --git a/src/lib_shell_services/shell_limits.ml b/src/lib_shell_services/shell_limits.ml index f8e8589cf87001d3d4d9375a466478fca9835115..9620b1d714488e856a0dbb5c46e178fbc36d9cdf 100644 --- a/src/lib_shell_services/shell_limits.ml +++ b/src/lib_shell_services/shell_limits.ml @@ -245,7 +245,7 @@ let chain_validator_limits_encoding = }); ]) -let default_storage_maintenance_context_pruning = Storage_maintenance.Enabled +let default_disable_context_pruning = false let default_storage_maintenance_delay = Storage_maintenance.Disabled @@ -255,7 +255,7 @@ type limits = { peer_validator_limits : peer_validator_limits; chain_validator_limits : chain_validator_limits; history_mode : History_mode.t option; - context_pruning : Storage_maintenance.context_pruning option; + disable_context_pruning : bool option; storage_maintenance_delay : Storage_maintenance.delay option; } @@ -266,7 +266,7 @@ let default_limits = peer_validator_limits = default_peer_validator_limits; chain_validator_limits = default_chain_validator_limits; history_mode = None; - context_pruning = Some Enabled; + disable_context_pruning = Some false; storage_maintenance_delay = Some Disabled; } @@ -279,7 +279,7 @@ let limits_encoding = prevalidator_limits; chain_validator_limits; history_mode; - context_pruning; + disable_context_pruning; storage_maintenance_delay; } -> ( peer_validator_limits, @@ -287,14 +287,14 @@ let limits_encoding = prevalidator_limits, chain_validator_limits, history_mode, - context_pruning, + disable_context_pruning, storage_maintenance_delay )) (fun ( peer_validator_limits, block_validator_limits, prevalidator_limits, chain_validator_limits, history_mode, - context_pruning, + disable_context_pruning, storage_maintenance_delay ) -> { peer_validator_limits; @@ -302,7 +302,7 @@ let limits_encoding = prevalidator_limits; chain_validator_limits; history_mode; - context_pruning; + disable_context_pruning; storage_maintenance_delay; }) (obj7 @@ -323,5 +323,5 @@ let limits_encoding = chain_validator_limits_encoding default_chain_validator_limits) (opt "history_mode" History_mode.encoding) - (opt "context_pruning" Storage_maintenance.context_pruning_encoding) + (opt "disable_context_pruning" bool) (opt "storage_maintenance_delay" Storage_maintenance.delay_encoding)) diff --git a/src/lib_shell_services/shell_limits.mli b/src/lib_shell_services/shell_limits.mli index 86813499bc559c5befc86ec260fcc207b6918670..991928a699c725f3ca2e93b7700622befde43505 100644 --- a/src/lib_shell_services/shell_limits.mli +++ b/src/lib_shell_services/shell_limits.mli @@ -93,8 +93,7 @@ val default_chain_validator_limits : chain_validator_limits val chain_validator_limits_encoding : chain_validator_limits Data_encoding.t -val default_storage_maintenance_context_pruning : - Storage_maintenance.context_pruning +val default_disable_context_pruning : bool val default_storage_maintenance_delay : Storage_maintenance.delay @@ -104,7 +103,7 @@ type limits = { peer_validator_limits : peer_validator_limits; chain_validator_limits : chain_validator_limits; history_mode : History_mode.t option; - context_pruning : Storage_maintenance.context_pruning option; + disable_context_pruning : bool option; storage_maintenance_delay : Storage_maintenance.delay option; } diff --git a/src/lib_shell_services/storage_maintenance.ml b/src/lib_shell_services/storage_maintenance.ml index 009cf21d73e2909e40d1d15281d21515fda9e4ac..49a8fb0ed020f00e4b2da9fa2d9f29dab1d2ff9d 100644 --- a/src/lib_shell_services/storage_maintenance.ml +++ b/src/lib_shell_services/storage_maintenance.ml @@ -5,40 +5,6 @@ (* *) (*****************************************************************************) -type context_pruning = Enabled | Disabled - -let context_pruning_encoding = - let open Data_encoding in - def - "context_pruning" - ~title:"context_pruning" - ~description:"Context pruning status" - (union - ~tag_size:`Uint8 - [ - case - ~title:"disabled" - ~description: - "When disabled, the storage maintenance won't be triggered" - (Tag 0) - (constant "disabled") - (function Disabled -> Some () | _ -> None) - (fun () -> Disabled); - case - ~title:"enabled" - ~description: - "When enabled, the storage maintenance is triggered as soon as a \ - cycle dawn is encountered. This is the default value." - (Tag 1) - (constant "enabled") - (function Enabled -> Some () | _ -> None) - (fun () -> Enabled); - ]) - -let pp_context_pruning fmt = function - | Disabled -> Format.fprintf fmt "disabled" - | Enabled -> Format.fprintf fmt "enabled" - type delay = Disabled | Custom of Int32.t let delay_encoding = diff --git a/src/lib_shell_services/storage_maintenance.mli b/src/lib_shell_services/storage_maintenance.mli index 8700ad0c7113cce8214577d53803fbd7ee156425..6cda256176417e02aa70b77b02deddf2505528fd 100644 --- a/src/lib_shell_services/storage_maintenance.mli +++ b/src/lib_shell_services/storage_maintenance.mli @@ -12,14 +12,6 @@ *) -(** The type [context_pruning] specifies whether or not a storage maintenance - should be triggered (if [Enabled]) or not (if [Disabled]). *) -type context_pruning = Enabled | Disabled - -val context_pruning_encoding : context_pruning Data_encoding.t - -val pp_context_pruning : Format.formatter -> context_pruning -> unit - (** The type [delay] specifies whether or not a storage maintenance should be delayed or not. Setting it to [Disabled] will trigger the storage maintenance as diff --git a/src/lib_store/mocked/store.ml b/src/lib_store/mocked/store.ml index 33fecb934c5632760c85ac6b262238954f0d5105..fce76d6df03aebc53607fddcd29d15da124f2d00 100644 --- a/src/lib_store/mocked/store.ml +++ b/src/lib_store/mocked/store.ml @@ -1818,8 +1818,8 @@ let store_dirs = ref [] let context_dirs = ref [] let init ?patch_context ?commit_genesis ?history_mode ?(readonly = false) - ?block_cache_limit ?context_pruning:_ ?maintenance_delay:_ ~store_dir - ~context_dir ~allow_testchains genesis = + ?block_cache_limit ?disable_context_pruning:_ ?maintenance_delay:_ + ~store_dir ~context_dir ~allow_testchains genesis = let open Lwt_result_syntax in if List.mem ~equal:String.equal context_dir !context_dirs then Format.kasprintf diff --git a/src/lib_store/shared/store_events.ml b/src/lib_store/shared/store_events.ml index 801d52006c8305241742fee39da446a93e125131..442b65340d9e94935ffed1ba6800844d8daf3510 100644 --- a/src/lib_store/shared/store_events.ml +++ b/src/lib_store/shared/store_events.ml @@ -35,11 +35,10 @@ let init_store = ~level:Info ~name:"init_store" ~msg: - "initializing the store (readonly:{ro}, \ - context_pruning:{context_pruning})" + "initializing the store (readonly: {ro}, disable context pruning: \ + {disable_context_pruning})" ("ro", Data_encoding.bool) - ~pp2:Storage_maintenance.pp_context_pruning - ("context_pruning", Storage_maintenance.context_pruning_encoding) + ("disable_context_pruning", Data_encoding.bool) let end_init_store = declare_0 diff --git a/src/lib_store/store.mli b/src/lib_store/store.mli index 5406aaa1e1577ab431788c0c030565122b1d1f74..16e17136e8560265c93f5690d55654de999e33aa 100644 --- a/src/lib_store/store.mli +++ b/src/lib_store/store.mli @@ -206,9 +206,9 @@ type chain_store @param block_cache_limit allows to override the size of the block cache to use. The minimal value is 1. - @param context_pruning specifies whether or not the context - pruning is expected to be run (if set to Enabled) or not (if set - to Disabled) during a storage maintenance. + @param disable_context_pruning specifies whether or not the + context pruning is expected to be run (if set to true) or not (if + set to false -- default) during a storage maintenance. @param maintenace_delay allows to introduce a delay prior to the trigger of the storage maintenance @@ -226,7 +226,7 @@ val init : ?history_mode:History_mode.t -> ?readonly:bool -> ?block_cache_limit:int -> - ?context_pruning:Storage_maintenance.context_pruning -> + ?disable_context_pruning:bool -> ?maintenance_delay:Storage_maintenance.delay -> store_dir:string -> context_dir:string -> diff --git a/src/lib_store/unix/block_store.ml b/src/lib_store/unix/block_store.ml index c5eedfe38aa6276e37d88a8bae752ee5dc2af63b..0b78d985a06d1c63f97e82a54c811984feb864e4 100644 --- a/src/lib_store/unix/block_store.ml +++ b/src/lib_store/unix/block_store.ml @@ -1370,10 +1370,10 @@ let create_merging_thread block_store ~history_mode ~old_ro_store ~old_rw_store in return (new_ro_store, new_savepoint, new_caboose) -let may_trigger_gc ~context_pruning block_store history_mode ~previous_savepoint - ~new_savepoint = +let may_trigger_gc ~disable_context_pruning block_store history_mode + ~previous_savepoint ~new_savepoint = let open Lwt_result_syntax in - if context_pruning = Storage_maintenance.Enabled then + if not disable_context_pruning then let savepoint_hash = fst new_savepoint in if History_mode.(equal history_mode Archive) @@ -1397,7 +1397,8 @@ let split_context block_store new_head_lpbl = let merge_stores ?(cycle_size_limit = default_cycle_size_limit) block_store ~(on_error : tztrace -> unit tzresult Lwt.t) ~finalizer ~history_mode - ~new_head ~new_head_metadata ~cementing_highwatermark ~context_pruning = + ~new_head ~new_head_metadata ~cementing_highwatermark + ~disable_context_pruning = let open Lwt_result_syntax in let* () = fail_when block_store.readonly Cannot_write_in_readonly in (* Do not allow multiple merges: force waiting for a potential @@ -1517,7 +1518,7 @@ let merge_stores ?(cycle_size_limit = default_cycle_size_limit) block_store its end. *) let* () = may_trigger_gc - ~context_pruning + ~disable_context_pruning block_store history_mode ~previous_savepoint diff --git a/src/lib_store/unix/block_store.mli b/src/lib_store/unix/block_store.mli index e8dce418b8ee48e6760498c7e2c7291795d00683..76ff216082592ae4cc2d14d0c356849d1dd4675e 100644 --- a/src/lib_store/unix/block_store.mli +++ b/src/lib_store/unix/block_store.mli @@ -286,8 +286,8 @@ val default_cycle_size_limit : int32 After the cementing, {!Cemented_block_store.trigger_gc} will be called with the given [history_mode]. When the merging thread succeeds, the callback [finalizer] will be called. Note that - depending on [context_pruning], the context pruning may be - discarded. + depending on the [disable_context_pruning] flag, the context + pruning may be discarded. If a merge thread is already occurring, this function will first wait for the previous merge to be done. @@ -308,7 +308,7 @@ val merge_stores : new_head:Block_repr.t -> new_head_metadata:Block_repr.metadata -> cementing_highwatermark:int32 -> - context_pruning:Storage_maintenance.context_pruning -> + disable_context_pruning:bool -> unit tzresult Lwt.t val get_merge_status : t -> merge_status diff --git a/src/lib_store/unix/store.ml b/src/lib_store/unix/store.ml index 75b4711fd61fa4b756f96946080e86707dc7af47..5e24dde9572cdb4e0b67049e073e47727db3111d 100644 --- a/src/lib_store/unix/store.ml +++ b/src/lib_store/unix/store.ml @@ -96,7 +96,7 @@ and chain_store = { Protocol_hash.Table.t; lockfile : Lwt_unix.file_descr; stored_data_lockfile : Lwt_unix.file_descr; - context_pruning : Storage_maintenance.context_pruning; + disable_context_pruning : bool; storage_maintenance : storage_maintenance; } @@ -1658,13 +1658,13 @@ module Chain = struct As the split is necessary in the scope of the context pruning only, it may be discarded depending on - [context_pruning]. However, it is mandatory that the split is not - delayed by the [maintenance_delay] argument as the split must - occur at the cycle start. *) - let may_split_context ~context_pruning chain_store new_head_lpbl previous_head - = + [disabled_context_pruning]. However, it is mandatory that the + split is not delayed by the [maintenance_delay] argument as the + split must occur at the cycle start. *) + let may_split_context ~disable_context_pruning chain_store new_head_lpbl + previous_head = let open Lwt_result_syntax in - if context_pruning = Storage_maintenance.Enabled then + if not disable_context_pruning then match history_mode chain_store with | Archive -> return_unit | Full _ | Rolling _ -> @@ -1735,7 +1735,7 @@ module Chain = struct in let* () = may_split_context - ~context_pruning:chain_store.context_pruning + ~disable_context_pruning:chain_store.disable_context_pruning chain_store new_head_lpbl previous_head @@ -1902,7 +1902,8 @@ module Chain = struct (WithExceptions.Option.get ~loc:__LOC__ cementing_highwatermark) - ~context_pruning:chain_store.context_pruning + ~disable_context_pruning: + chain_store.disable_context_pruning in (* The new memory highwatermark is new_head_lpbl, the disk value will be updated after the merge completion. *) @@ -2258,7 +2259,7 @@ module Chain = struct } let create_chain_store ?block_cache_limit global_store chain_dir ?target - ~chain_id ?(expiration = None) ~context_pruning ~maintenance_delay + ~chain_id ?(expiration = None) ~disable_context_pruning ~maintenance_delay ?genesis_block ~genesis ~genesis_context history_mode = let open Lwt_result_syntax in (* Chain directory *) @@ -2313,14 +2314,14 @@ module Chain = struct block_rpc_directories; lockfile; stored_data_lockfile; - context_pruning; + disable_context_pruning; storage_maintenance = {maintenance_delay; scheduled_maintenance}; } in return chain_store let load_chain_store ?block_cache_limit global_store chain_dir ~chain_id - ~readonly ~context_pruning ~maintenance_delay = + ~readonly ~disable_context_pruning ~maintenance_delay = let open Lwt_result_syntax in let* chain_config_data = Stored_data.load (Naming.chain_config_file chain_dir) @@ -2367,7 +2368,7 @@ module Chain = struct block_rpc_directories; lockfile; stored_data_lockfile; - context_pruning; + disable_context_pruning; storage_maintenance = {maintenance_delay; scheduled_maintenance}; } in @@ -2447,7 +2448,7 @@ module Chain = struct testchain_dir ~chain_id ~readonly:false - ~context_pruning:Enabled + ~disable_context_pruning:false ~maintenance_delay in let testchain = {forked_block; testchain_store} in @@ -2519,7 +2520,7 @@ module Chain = struct testchain_dir ~chain_id:testchain_id ~expiration:(Some expiration) - ~context_pruning:Enabled + ~disable_context_pruning:false ~maintenance_delay:Storage_maintenance.Disabled ~genesis_block ~genesis @@ -2786,7 +2787,7 @@ end let create_store ?block_cache_limit ~context_index ~chain_id ~genesis ~genesis_context ?(history_mode = History_mode.default) ~allow_testchains - ~context_pruning ~maintenance_delay store_dir = + ~disable_context_pruning ~maintenance_delay store_dir = let open Lwt_result_syntax in let store_dir_path = Naming.dir_path store_dir in let*! () = Lwt_utils_unix.create_dir store_dir_path in @@ -2812,7 +2813,7 @@ let create_store ?block_cache_limit ~context_index ~chain_id ~genesis chain_dir ~chain_id ~expiration:None - ~context_pruning + ~disable_context_pruning ~maintenance_delay ~genesis ~genesis_context @@ -2822,7 +2823,7 @@ let create_store ?block_cache_limit ~context_index ~chain_id ~genesis return global_store let load_store ?history_mode ?block_cache_limit store_dir ~context_index - ~genesis ~chain_id ~allow_testchains ~readonly ~context_pruning + ~genesis ~chain_id ~allow_testchains ~readonly ~disable_context_pruning ~maintenance_delay () = let open Lwt_result_syntax in let chain_dir = Naming.chain_dir store_dir chain_id in @@ -2876,7 +2877,7 @@ let load_store ?history_mode ?block_cache_limit store_dir ~context_index chain_dir ~chain_id ~readonly - ~context_pruning + ~disable_context_pruning ~maintenance_delay in let stored_genesis = Chain.genesis main_chain_store in @@ -2916,11 +2917,13 @@ let check_history_mode_consistency chain_dir history_mode = else (* Store is not yet initialized. *) return_unit let init ?patch_context ?commit_genesis ?history_mode ?(readonly = false) - ?block_cache_limit ?(context_pruning = Storage_maintenance.Enabled) + ?block_cache_limit ?(disable_context_pruning = false) ?(maintenance_delay = Storage_maintenance.Disabled) ~store_dir ~context_dir ~allow_testchains genesis = let open Lwt_result_syntax in - let*! () = Store_events.(emit init_store) (readonly, context_pruning) in + let*! () = + Store_events.(emit init_store) (readonly, disable_context_pruning) + in let store_dir = Naming.store_dir ~dir_path:store_dir in let chain_id = Chain_id.of_block_hash genesis.Genesis.block in let chain_dir = Naming.chain_dir store_dir chain_id in @@ -2960,7 +2963,7 @@ let init ?patch_context ?commit_genesis ?history_mode ?(readonly = false) ~chain_id ~allow_testchains ~readonly - ~context_pruning + ~disable_context_pruning ~maintenance_delay () else @@ -2971,7 +2974,7 @@ let init ?patch_context ?commit_genesis ?history_mode ?(readonly = false) store_dir ~context_index ~chain_id - ~context_pruning + ~disable_context_pruning ~genesis ~genesis_context ?history_mode @@ -3115,7 +3118,7 @@ let may_switch_history_mode ~store_dir ~context_dir genesis ~new_history_mode = ~chain_id ~allow_testchains:true ~readonly:false - ~context_pruning:Enabled + ~disable_context_pruning:false ~maintenance_delay:Storage_maintenance.Disabled () in @@ -3498,7 +3501,7 @@ module Unsafe = struct ~chain_id ~allow_testchains:false ~readonly:true - ~context_pruning:Disabled + ~disable_context_pruning:true ~maintenance_delay:Storage_maintenance.Disabled () in diff --git a/src/lib_store/unix/store.mli b/src/lib_store/unix/store.mli index b129d4748e8a999005502f00ebd4c83efff7671c..67813818417b00e4212499c3cd9f2e0c9f727a34 100644 --- a/src/lib_store/unix/store.mli +++ b/src/lib_store/unix/store.mli @@ -205,9 +205,9 @@ type chain_store @param block_cache_limit allows to override the size of the block cache to use. The minimal value is 1. - @param context_pruning specifies whether or not the context - pruning is expected to be run (if set to Enabled) or not (if set - to Disabled) during a storage maintenance. + @param disable_context_pruning specifies whether or not the + context pruning is expected to be run (if set to true) or not (if + set to false -- default) during a storage maintenance. @param maintenace_delay allows to introduce a delay prior to the trigger of the storage maintenance @@ -224,7 +224,7 @@ val init : ?history_mode:History_mode.t -> ?readonly:bool -> ?block_cache_limit:int -> - ?context_pruning:Storage_maintenance.context_pruning -> + ?disable_context_pruning:bool -> ?maintenance_delay:Storage_maintenance.delay -> store_dir:string -> context_dir:string -> diff --git a/src/lib_store/unix/test/test_block_store.ml b/src/lib_store/unix/test/test_block_store.ml index 3d22203ba253668ee000404314e91f0b7a9531b6..23b79c2e02be5a3e0e7d9dd18cd7a7bf1b6be320 100644 --- a/src/lib_store/unix/test/test_block_store.ml +++ b/src/lib_store/unix/test/test_block_store.ml @@ -259,7 +259,7 @@ let test_simple_merge block_store = ~new_head:head ~new_head_metadata:head_metadata ~cementing_highwatermark:0l - ~context_pruning:Enabled + ~disable_context_pruning:false in let*! () = Block_store.await_merging block_store in assert_cemented_bound @@ -315,7 +315,7 @@ let test_consecutive_concurrent_merges block_store = ~new_head ~new_head_metadata ~cementing_highwatermark:previous_cycle_lpbl - ~context_pruning:Enabled + ~disable_context_pruning:false in let threads = List.map merge_cycle cycles_to_merge in let*! res = Lwt.all threads in @@ -360,7 +360,7 @@ let test_ten_cycles_merge block_store = (head |> Block_repr.metadata |> WithExceptions.Option.to_exn ~none:Not_found) ~cementing_highwatermark:0l - ~context_pruning:Enabled + ~disable_context_pruning:false in let* () = assert_presence_in_block_store ~with_metadata:true block_store all_blocks @@ -462,7 +462,7 @@ let test_merge_with_branches block_store = (head |> Block_repr.metadata |> WithExceptions.Option.to_exn ~none:Not_found) ~cementing_highwatermark:0l - ~context_pruning:Enabled + ~disable_context_pruning:false in let*! () = Block_store.await_merging block_store in let* () = @@ -501,7 +501,7 @@ let perform_n_cycles_merge ?(cycle_length = 10) (head |> Block_repr.metadata |> WithExceptions.Option.to_exn ~none:Not_found) ~cementing_highwatermark:0l - ~context_pruning:Enabled + ~disable_context_pruning:false in let*! () = Block_store.await_merging block_store in return cycles diff --git a/tezt/lib_tezos/node.ml b/tezt/lib_tezos/node.ml index 201666765504dc4b9e24a0a5c0bf82c2f214f542..32b250830ae3b73e95541ff20041589476f6c7d4 100644 --- a/tezt/lib_tezos/node.ml +++ b/tezt/lib_tezos/node.ml @@ -42,7 +42,7 @@ type argument = | RPC_additional_addr_external of string | Max_active_rpc_connections of int | Enable_http_cache_headers - | Context_pruning of string + | Disable_context_pruning | Storage_maintenance_delay of string let make_argument = function @@ -78,7 +78,7 @@ let make_argument = function | Max_active_rpc_connections n -> ["--max-active-rpc-connections"; string_of_int n] | Enable_http_cache_headers -> ["--enable-http-cache-headers"] - | Context_pruning x -> ["--context-pruning"; x] + | Disable_context_pruning -> ["--disable-context-pruning"] | Storage_maintenance_delay x -> ["--storage-maintenance-delay"; x] let make_arguments arguments = List.flatten (List.map make_argument arguments) @@ -104,7 +104,7 @@ let is_redundant = function | Version, Version | Max_active_rpc_connections _, Max_active_rpc_connections _ | Enable_http_cache_headers, Enable_http_cache_headers - | Context_pruning _, Context_pruning _ + | Disable_context_pruning, Disable_context_pruning | Storage_maintenance_delay _, Storage_maintenance_delay _ -> true | Metrics_addr addr1, Metrics_addr addr2 -> addr1 = addr2 @@ -132,7 +132,7 @@ let is_redundant = function | Version, _ | Max_active_rpc_connections _, _ | Enable_http_cache_headers, _ - | Context_pruning _, _ + | Disable_context_pruning, _ | Storage_maintenance_delay _, _ -> false diff --git a/tezt/lib_tezos/node.mli b/tezt/lib_tezos/node.mli index d8c3222d03d23dd94379b4c84475a821eb89baa1..bf590bff059164acd06c17ee1d430d4103a1f11a 100644 --- a/tezt/lib_tezos/node.mli +++ b/tezt/lib_tezos/node.mli @@ -100,7 +100,7 @@ type argument = | RPC_additional_addr_external of string (** [--external-rpc-addr] *) | Max_active_rpc_connections of int (** [--max-active-rpc-connections] *) | Enable_http_cache_headers (** [--enable-http-cache-headers] *) - | Context_pruning of string (** [--context-pruning] *) + | Disable_context_pruning (** [--disable_context-pruning] *) | Storage_maintenance_delay of string (** [--storage-maintenance-delay]*) (** A TLS configuration for the node: paths to a [.crt] and a [.key] file. diff --git a/tezt/tests/storage_maintenance.ml b/tezt/tests/storage_maintenance.ml index 3a59c77a0fa37df99f3339b1bfa4658677c9b2db..b65a3546b67664242c31acd4c66d7ae0617e74ed 100644 --- a/tezt/tests/storage_maintenance.ml +++ b/tezt/tests/storage_maintenance.ml @@ -41,7 +41,7 @@ let test_context_pruning_call = let* node1, client = Client.init_with_protocol ~node_name:"no_gc" - ~nodes_args:Node.[Synchronisation_threshold 0; Context_pruning "disabled"] + ~nodes_args:Node.[Synchronisation_threshold 0; Disable_context_pruning] `Client ~protocol ()