Rename
This commit is contained in:
parent
2d2c70cc7c
commit
77cec4930e
|
@ -1652,7 +1652,7 @@ end}.
|
|||
%% and refuse to start if the marker exists but tables are empty.
|
||||
%%
|
||||
|
||||
{mapping, "verify_initial_run", "rabbit.verify_initial_run", [
|
||||
{mapping, "prevent_startup_if_node_was_reset", "rabbit.prevent_startup_if_node_was_reset", [
|
||||
{datatype, {enum, [true, false]}}
|
||||
]}.
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
%% Boot steps.
|
||||
-export([update_cluster_tags/0, maybe_insert_default_data/0, boot_delegate/0, recover/0,
|
||||
pg_local_amqp_session/0,
|
||||
pg_local_amqp_connection/0, check_initial_run/0]).
|
||||
pg_local_amqp_connection/0, prevent_startup_if_node_was_reset/0]).
|
||||
|
||||
-rabbit_boot_step({pre_boot, [{description, "rabbit boot start"}]}).
|
||||
|
||||
|
@ -201,7 +201,7 @@
|
|||
|
||||
-rabbit_boot_step({initial_run_check,
|
||||
[{description, "check if this is the first time the node starts"},
|
||||
{mfa, {?MODULE, check_initial_run, []}},
|
||||
{mfa, {?MODULE, prevent_startup_if_node_was_reset, []}},
|
||||
{requires, recovery},
|
||||
{enables, empty_db_check}]}).
|
||||
|
||||
|
@ -1159,13 +1159,13 @@ update_cluster_tags() ->
|
|||
rabbit_runtime_parameters:set_global(cluster_tags, Tags, <<"internal_user">>).
|
||||
|
||||
|
||||
-spec check_initial_run() -> 'ok' | no_return().
|
||||
-spec prevent_startup_if_node_was_reset() -> 'ok' | no_return().
|
||||
|
||||
check_initial_run() ->
|
||||
case application:get_env(rabbit, verify_initial_run, false) of
|
||||
prevent_startup_if_node_was_reset() ->
|
||||
case application:get_env(rabbit, prevent_startup_if_node_was_reset, false) of
|
||||
false ->
|
||||
%% Feature is disabled, skip the check
|
||||
?LOG_DEBUG("Initial run verification is disabled",
|
||||
?LOG_DEBUG("prevent_startup_if_node_was_reset is disabled",
|
||||
#{domain => ?RMQLOG_DOMAIN_GLOBAL}),
|
||||
ok;
|
||||
true ->
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
|
||||
%% Test suite for the verify_initial_run feature.
|
||||
%% Test suite for the prevent_startup_if_node_was_reset feature.
|
||||
%% This feature helps detect potential data loss scenarios by maintaining
|
||||
%% a marker file to track if a node has been initialized before.
|
||||
|
||||
|
@ -25,12 +25,12 @@ all() ->
|
|||
groups() ->
|
||||
[
|
||||
{single_node_mnesia, [], [
|
||||
verify_initial_run_disabled,
|
||||
verify_initial_run_enabled
|
||||
prevent_startup_if_node_was_reset_disabled,
|
||||
prevent_startup_if_node_was_reset_enabled
|
||||
]},
|
||||
{single_node_khepri, [], [
|
||||
verify_initial_run_disabled,
|
||||
verify_initial_run_enabled
|
||||
prevent_startup_if_node_was_reset_disabled,
|
||||
prevent_startup_if_node_was_reset_enabled
|
||||
]}
|
||||
].
|
||||
|
||||
|
@ -76,7 +76,7 @@ end_per_testcase(Testcase, Config) ->
|
|||
%% Test cases
|
||||
%% -------------------------------------------------------------------
|
||||
|
||||
verify_initial_run_disabled(Config) ->
|
||||
prevent_startup_if_node_was_reset_disabled(Config) ->
|
||||
% When feature is disabled (default), node should start normally
|
||||
DataDir = rabbit_ct_broker_helpers:get_node_config(Config, 0, data_dir),
|
||||
MarkerFile = filename:join(DataDir, "node_initialized.marker"),
|
||||
|
@ -91,7 +91,7 @@ verify_initial_run_disabled(Config) ->
|
|||
?assertNot(filelib:is_file(MarkerFile)),
|
||||
ok.
|
||||
|
||||
verify_initial_run_enabled(Config) ->
|
||||
prevent_startup_if_node_was_reset_enabled(Config) ->
|
||||
DataDir = rabbit_ct_broker_helpers:get_node_config(Config, 0, data_dir),
|
||||
MarkerFile = filename:join(DataDir, "node_initialized.marker"),
|
||||
|
||||
|
@ -140,11 +140,11 @@ start_app(Config) ->
|
|||
Error -> Error
|
||||
end.
|
||||
|
||||
maybe_enable_verify_initial_run(Config, verify_initial_run_enabled) ->
|
||||
maybe_enable_prevent_startup_if_node_was_reset(Config, prevent_startup_if_node_was_reset_enabled) ->
|
||||
rabbit_ct_helpers:merge_app_env(
|
||||
Config, {rabbit, [{verify_initial_run, true}]}
|
||||
Config, {rabbit, [{prevent_startup_if_node_was_reset, true}]}
|
||||
);
|
||||
maybe_enable_verify_initial_run(Config, _) ->
|
||||
maybe_enable_prevent_startup_if_node_was_reset(Config, _) ->
|
||||
Config.
|
||||
|
||||
meta_store(single_node_mnesia) ->
|
||||
|
@ -165,4 +165,4 @@ schema_file(Config) ->
|
|||
|
||||
set_env(Config, Bool) ->
|
||||
Node = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
|
||||
ok = rpc:call(Node, application, set_env, [rabbit, verify_initial_run, Bool]).
|
||||
ok = rpc:call(Node, application, set_env, [rabbit, prevent_startup_if_node_was_reset, Bool]).
|
||||
|
|
Loading…
Reference in New Issue