summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@novemberain.com>2019-03-15 03:33:11 +0300
committerGitHub <noreply@github.com>2019-03-15 03:33:11 +0300
commit9bc3386e5816732ff88ef0613a12ba0bf0043516 (patch)
treed069fa2f241a812a48c51648cd2d4f9ea89a8577
parentc46020f15646febe2d32653defa0e94e55ff144a (diff)
parenta2dabd48b8300cdf091b5788508837bffcd76fbe (diff)
downloadrabbitmq-server-git-9bc3386e5816732ff88ef0613a12ba0bf0043516.tar.gz
Merge pull request #1913 from rabbitmq/rabbitmq-server-1869
Move TCP and TLS listener startup to the last boot step "stage"
-rw-r--r--src/rabbit.erl49
-rw-r--r--src/rabbit_boot_steps.erl17
-rw-r--r--src/rabbit_vhost.erl3
3 files changed, 42 insertions, 27 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 20f9b17abf..003abd141f 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -197,43 +197,52 @@
-rabbit_boot_step({routing_ready,
[{description, "message delivery logic ready"},
- {requires, core_initialized}]}).
-
--rabbit_boot_step({direct_client,
- [{description, "direct client"},
- {mfa, {rabbit_direct, boot, []}},
- {requires, routing_ready}]}).
+ {requires, [core_initialized, recovery]}]}).
-rabbit_boot_step({connection_tracking,
- [{description, "sets up internal storage for node-local connections"},
+ [{description, "connection tracking infrastructure"},
{mfa, {rabbit_connection_tracking, boot, []}},
- {requires, routing_ready}]}).
-
--rabbit_boot_step({networking,
- [{mfa, {rabbit_networking, boot, []}},
- {requires, routing_ready}]}).
-
--rabbit_boot_step({notify_cluster,
- [{description, "notify cluster nodes"},
- {mfa, {rabbit_node_monitor, notify_node_up, []}},
- {requires, networking}]}).
+ {enables, routing_ready}]}).
-rabbit_boot_step({background_gc,
[{description, "background garbage collection"},
{mfa, {rabbit_sup, start_restartable_child,
[background_gc]}},
- {enables, networking}]}).
+ {requires, [core_initialized, recovery]},
+ {enables, routing_ready}]}).
-rabbit_boot_step({rabbit_core_metrics_gc,
[{description, "background core metrics garbage collection"},
{mfa, {rabbit_sup, start_restartable_child,
[rabbit_core_metrics_gc]}},
- {enables, networking}]}).
+ {requires, [core_initialized, recovery]},
+ {enables, routing_ready}]}).
-rabbit_boot_step({rabbit_looking_glass,
[{description, "Looking Glass tracer and profiler"},
{mfa, {rabbit_looking_glass, boot, []}},
- {requires, networking}]}).
+ {requires, [core_initialized, recovery]},
+ {enables, routing_ready}]}).
+
+-rabbit_boot_step({pre_flight,
+ [{description, "ready to communicate with peers and clients"},
+ {requires, [core_initialized, recovery, routing_ready]}]}).
+
+-rabbit_boot_step({direct_client,
+ [{description, "direct client"},
+ {mfa, {rabbit_direct, boot, []}},
+ {requires, pre_flight}
+ ]}).
+
+-rabbit_boot_step({notify_cluster,
+ [{description, "notifies cluster peers of our presence"},
+ {mfa, {rabbit_node_monitor, notify_node_up, []}},
+ {requires, pre_flight}]}).
+
+-rabbit_boot_step({networking,
+ [{description, "TCP and TLS listeners"},
+ {mfa, {rabbit_networking, boot, []}},
+ {requires, notify_cluster}]}).
%%---------------------------------------------------------------------------
diff --git a/src/rabbit_boot_steps.erl b/src/rabbit_boot_steps.erl
index 21366877db..24ff878165 100644
--- a/src/rabbit_boot_steps.erl
+++ b/src/rabbit_boot_steps.erl
@@ -23,7 +23,10 @@ run_boot_steps() ->
run_boot_steps(loaded_applications()).
run_boot_steps(Apps) ->
- [ok = run_step(Attrs, mfa) || {_, _, Attrs} <- find_steps(Apps)],
+ [begin
+ rabbit_log:info("Running boot step ~s defined by app ~s", [Step, App]),
+ ok = run_step(Attrs, mfa)
+ end || {App, Step, Attrs} <- find_steps(Apps)],
ok.
run_cleanup_steps(Apps) ->
@@ -46,10 +49,14 @@ run_step(Attributes, AttributeName) ->
[] ->
ok;
MFAs ->
- [case apply(M,F,A) of
- ok -> ok;
- {error, Reason} -> exit({error, Reason})
- end || {M,F,A} <- MFAs],
+ [begin
+ rabbit_log:debug("Applying MFA: M = ~s, F = ~s, A = ~p",
+ [M, F, A]),
+ case apply(M,F,A) of
+ ok -> ok;
+ {error, Reason} -> exit({error, Reason})
+ end
+ end || {M,F,A} <- MFAs],
ok
end.
diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl
index 1721c9b806..6652fb8d5f 100644
--- a/src/rabbit_vhost.erl
+++ b/src/rabbit_vhost.erl
@@ -42,8 +42,7 @@ recover() ->
%% So recovery will be run every time a vhost supervisor is restarted.
ok = rabbit_vhost_sup_sup:start(),
- [ ok = rabbit_vhost_sup_sup:init_vhost(VHost)
- || VHost <- rabbit_vhost:list()],
+ [ok = rabbit_vhost_sup_sup:init_vhost(VHost) || VHost <- rabbit_vhost:list()],
ok.
recover(VHost) ->