Merge pull request #8333 from zhongwencool/conf-refactor

chore: choose core node's max tnxid as source conf
This commit is contained in:
zhongwencool 2022-06-28 16:57:26 +08:00 committed by GitHub
commit 7a4242ea1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 134 deletions

View File

@ -1,125 +0,0 @@
######################################################################
## Erlang VM Args
######################################################################
## NOTE:
##
## Arguments configured in this file might be overridden by configs from `emqx.conf`.
##
## Some basic VM arguments are to be configured in `emqx.conf`,
## such as `node.name` for `-name` and `node.cooke` for `-setcookie`.
## Sets the maximum number of simultaneously existing processes for this system.
+P 16384
## Sets the maximum number of simultaneously existing ports for this system.
+Q 4096
## Sets the maximum number of ETS tables
+e 512
## Sets the maximum number of atoms the virtual machine can handle.
+t 262144
## Set the location of crash dumps
-env ERL_CRASH_DUMP {{ platform_log_dir }}/crash.dump
## Set how many times generational garbages collections can be done without
## forcing a fullsweep collection.
-env ERL_FULLSWEEP_AFTER 0
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!)
-heart
## Specify the erlang distributed protocol.
## Can be one of: inet_tcp, inet6_tcp, inet_tls
#-proto_dist inet_tcp
## The shell is started in a restricted mode.
## In this mode, the shell evaluates a function call only if allowed.
## Prevent user from accidentally calling a function from the prompt that could harm a running system.
-stdlib restricted_shell emqx_restricted_shell
## Specify SSL Options in the file if using SSL for Erlang Distribution.
## Used only when -proto_dist set to inet_tls
#-ssl_dist_optfile {{ platform_etc_dir }}/ssl_dist.conf
## Specifies the net_kernel tick time in seconds.
## This is the approximate time a connected node may be unresponsive until
## it is considered down and thereby disconnected.
#-kernel net_ticktime 60
## Sets the distribution buffer busy limit (dist_buf_busy_limit).
+zdbbl 1024
## Sets default scheduler hint for port parallelism.
+spp false
## Sets the number of threads in async thread pool. Valid range is 0-1024.
## Increase the parameter if there are many simultaneous file I/O operations.
+A 1
## Sets the default heap size of processes to the size Size.
#+hms 233
## Sets the default binary virtual heap size of processes to the size Size.
#+hmbs 46422
## Sets the default maximum heap size of processes to the size Size.
## Defaults to 0, which means that no maximum heap size is used.
##For more information, see process_flag(max_heap_size, MaxHeapSize).
#+hmax 0
## Sets the default value for process flag message_queue_data. Defaults to on_heap.
#+hmqd on_heap | off_heap
## Sets the number of IO pollsets to use when polling for I/O.
+IOp 1
## Sets the number of IO poll threads to use when polling for I/O.
+IOt 1
## Sets the number of scheduler threads to create and scheduler threads to set online.
+S 1:1
## Sets the number of dirty CPU scheduler threads to create and dirty CPU scheduler threads to set online.
+SDcpu 1:1
## Sets the number of dirty I/O scheduler threads to create.
+SDio 1
## Suggested stack size, in kilowords, for scheduler threads.
#+sss 32
## Suggested stack size, in kilowords, for dirty CPU scheduler threads.
#+sssdcpu 40
## Suggested stack size, in kilowords, for dirty IO scheduler threads.
#+sssdio 40
## Sets scheduler bind type.
## Can be one of: u, ns, ts, ps, s, nnts, nnps, tnnps, db
#+sbt db
## Sets a user-defined CPU topology.
#+sct L0-3c0-3p0N0:L4-7c0-3p1N1
## Sets the mapping of warning messages for error_logger
#+W w
## Sets time warp mode: no_time_warp | single_time_warp | multi_time_warp
#+C no_time_warp
## Prevents loading information about source filenames and line numbers.
+L
## Specifies how long time (in milliseconds) to spend shutting down the system.
## See: http://erlang.org/doc/man/erl.html
-shutdown_time 10000
## patches dir
-pa "{{ platform_data_dir }}/patches"
## Mnesia thresholds
-mnesia dump_log_write_threshold 5000
-mnesia dump_log_time_threshold 60000

View File

@ -139,13 +139,7 @@ copy_override_conf_from_core_node() ->
copy_override_conf_from_core_node() copy_override_conf_from_core_node()
end; end;
_ -> _ ->
SortFun = fun( [{ok, Info} | _] = lists:sort(fun conf_sort/2, Ready),
{ok, #{wall_clock := W1}},
{ok, #{wall_clock := W2}}
) ->
W1 > W2
end,
[{ok, Info} | _] = lists:sort(SortFun, Ready),
#{node := Node, conf := RawOverrideConf, tnx_id := TnxId} = Info, #{node := Node, conf := RawOverrideConf, tnx_id := TnxId} = Info,
Msg = #{ Msg = #{
msg => "copy_overide_conf_from_core_node_success", msg => "copy_overide_conf_from_core_node_success",
@ -173,3 +167,9 @@ should_proceed_with_boot() ->
%% be up. Try again. %% be up. Try again.
false false
end. end.
conf_sort({ok, #{tnx_id := Id1}}, {ok, #{tnx_id := Id2}}) when Id1 > Id2 -> true;
conf_sort({ok, #{tnx_id := Id, wall_clock := W1}}, {ok, #{tnx_id := Id, wall_clock := W2}}) ->
W1 > W2;
conf_sort({ok, _}, {ok, _}) ->
false.

View File

@ -370,7 +370,7 @@ defmodule EMQXUmbrella.MixProject do
vm_args_template_path = vm_args_template_path =
case release_type do case release_type do
:cloud -> :cloud ->
"apps/emqx/etc/emqx_cloud/vm.args" "apps/emqx/etc/vm.args.cloud"
end end
render_template( render_template(

View File

@ -412,7 +412,7 @@ emqx_etc_overlay(ReleaseType, Edition) ->
emqx_etc_overlay_common(). emqx_etc_overlay_common().
emqx_etc_overlay_per_rel(cloud) -> emqx_etc_overlay_per_rel(cloud) ->
[{"{{base_dir}}/lib/emqx/etc/emqx_cloud/vm.args", "etc/vm.args"}]. [{"{{base_dir}}/lib/emqx/etc/vm.args.cloud", "etc/vm.args"}].
emqx_etc_overlay_common() -> emqx_etc_overlay_common() ->
[{"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"}]. [{"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"}].