summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-02-04 12:03:25 +0100
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-02-04 12:03:25 +0100
commit6535c6f656012a588a3eaa22200bf106e9672c85 (patch)
tree687e592173e38a0f4727001940b6fccc2e821899 /src
parenta42fbe0a250055031649a6302873f2c94c3a5cb0 (diff)
downloadrabbitmq-server-git-6535c6f656012a588a3eaa22200bf106e9672c85.tar.gz
rabbit: Load plugins and init feature flags before we check cluster consistency
This is required because the feature flags (which depend on loaded plugins) must be known so we can compare them to remote nodes' feature flags. [#160169569]
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 2d16661768..d748fdaf7c 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -280,9 +280,11 @@ start() ->
HipeResult = rabbit_hipe:maybe_hipe_compile(),
ok = start_logger(),
rabbit_hipe:log_hipe_result(HipeResult),
+ Apps = load_all_apps(),
+ rabbit_feature_flags:initialize_registry(),
rabbit_node_monitor:prepare_cluster_status_files(),
rabbit_mnesia:check_cluster_consistency(),
- broker_start()
+ broker_start(Apps)
end).
-spec boot() -> 'ok'.
@@ -294,13 +296,15 @@ boot() ->
HipeResult = rabbit_hipe:maybe_hipe_compile(),
ok = start_logger(),
rabbit_hipe:log_hipe_result(HipeResult),
+ Apps = load_all_apps(),
+ rabbit_feature_flags:initialize_registry(),
rabbit_node_monitor:prepare_cluster_status_files(),
ok = rabbit_upgrade:maybe_upgrade_mnesia(),
%% It's important that the consistency check happens after
%% the upgrade, since if we are a secondary node the
%% primary node will have forgotten us
rabbit_mnesia:check_cluster_consistency(),
- broker_start()
+ broker_start(Apps)
end).
ensure_config() ->
@@ -321,11 +325,14 @@ ensure_config() ->
ok -> ok
end.
-
-broker_start() ->
+load_all_apps() ->
Plugins = rabbit_plugins:setup(),
ToBeLoaded = Plugins ++ ?APPS,
- start_apps(ToBeLoaded),
+ app_utils:load_applications(ToBeLoaded),
+ ToBeLoaded.
+
+broker_start(Apps) ->
+ start_loaded_apps(Apps),
maybe_sd_notify(),
ok = rabbit_lager:broker_is_started(),
ok = log_broker_started(rabbit_plugins:strictly_plugins(rabbit_plugins:active())).
@@ -518,6 +525,12 @@ start_apps(Apps) ->
start_apps(Apps, RestartTypes) ->
app_utils:load_applications(Apps),
rabbit_feature_flags:initialize_registry(),
+ start_loaded_apps(Apps, RestartTypes).
+
+start_loaded_apps(Apps) ->
+ start_loaded_apps(Apps, #{}).
+
+start_loaded_apps(Apps, RestartTypes) ->
ensure_sysmon_handler_app_config(),
%% make Ra use a custom logger that dispatches to lager instead of the
%% default OTP logger