fix(mnesia): поднять dump_log_write_threshold; Traefik base v3.3.6. Refs EventHub/EventHubBack#34 Refs EventHub/EventHubDevOps#3 [skip ci]
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
-export([start_link/0, init_tables/0, wait_for_tables/0, wait_for_table/1]).
|
||||
-export([add_cluster_nodes/1]).
|
||||
-export([configure_dump_log/0]).
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||
terminate/2, code_change/3]).
|
||||
|
||||
@@ -44,6 +45,35 @@ wait_for_tables() ->
|
||||
add_cluster_nodes(Nodes) ->
|
||||
gen_server:call(?MODULE, {add_nodes, Nodes}).
|
||||
|
||||
%% @doc Soften dump_log overload under write-heavy load (IFT stress).
|
||||
%% OTP warns {dump_log, write_threshold|time_threshold} when a new dump
|
||||
%% is requested while the previous dump still runs.
|
||||
%% Override: MNESIA_DUMP_LOG_WRITE_THRESHOLD (default 50000; OTP default ~1000).
|
||||
-spec configure_dump_log() -> ok.
|
||||
configure_dump_log() ->
|
||||
Threshold = env_int("MNESIA_DUMP_LOG_WRITE_THRESHOLD", 50000),
|
||||
case mnesia:change_config(dump_log_write_threshold, Threshold) of
|
||||
{ok, Old} ->
|
||||
io:format("Mnesia dump_log_write_threshold: ~p -> ~p~n", [Old, Threshold]),
|
||||
ok;
|
||||
Other ->
|
||||
io:format("Mnesia dump_log_write_threshold change failed: ~p~n", [Other]),
|
||||
ok
|
||||
end.
|
||||
|
||||
env_int(Name, Default) ->
|
||||
case os:getenv(Name) of
|
||||
false -> Default;
|
||||
"" -> Default;
|
||||
Val ->
|
||||
try list_to_integer(Val) of
|
||||
N when N > 0 -> N;
|
||||
_ -> Default
|
||||
catch
|
||||
error:badarg -> Default
|
||||
end
|
||||
end.
|
||||
|
||||
%% ===================================================================
|
||||
%% gen_server callbacks
|
||||
%% ===================================================================
|
||||
|
||||
Reference in New Issue
Block a user