Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/rabbit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ suites = [
name = "feature_flags_SUITE",
size = "large",
flaky = True,
shard_count = 9,
shard_count = 5,
runtime_deps = [
"//deps/rabbit/test/feature_flags_SUITE_data/my_plugin:erlang_app",
],
Expand Down
5 changes: 2 additions & 3 deletions deps/rabbit/src/rabbit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ start_apps(Apps, RestartTypes) ->
%% We need to load all applications involved in order to be able to
%% find new feature flags.
app_utils:load_applications(Apps),
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(Apps),
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(),
rabbit_prelaunch_conf:decrypt_config(Apps),
lists:foreach(
fun(App) ->
Expand Down Expand Up @@ -908,8 +908,7 @@ start(normal, []) ->
%% once, because it does not involve running code from the
%% plugins.
ok = app_utils:load_applications(Plugins),
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(
Plugins),
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(),

persist_static_configuration(),

Expand Down
49 changes: 32 additions & 17 deletions deps/rabbit/src/rabbit_core_ff.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

-module(rabbit_core_ff).

-include_lib("kernel/include/logger.hrl").

-include_lib("rabbit_common/include/logging.hrl").

-export([direct_exchange_routing_v2_enable/1,
listener_records_in_ets_enable/1,
listener_records_in_ets_post_enable/1,
Expand Down Expand Up @@ -70,7 +74,7 @@
-rabbit_feature_flag(
{feature_flags_v2,
#{desc => "Feature flags subsystem V2",
stability => stable
stability => required
}}).

-rabbit_feature_flag(
Expand Down Expand Up @@ -136,16 +140,18 @@ direct_exchange_routing_v2_enable(#{feature_name := FeatureName}) ->
ok ->
ok = rabbit_binding:populate_index_route_table();
{error, Err} = Error ->
rabbit_log_feature_flags:error(
?LOG_ERROR(
"Feature flags: `~ts`: failed to add copy of table ~ts to "
"node ~tp: ~tp",
[FeatureName, TableName, node(), Err]),
[FeatureName, TableName, node(), Err],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
Error
end
catch throw:{error, Reason} ->
rabbit_log_feature_flags:error(
?LOG_ERROR(
"Feature flags: `~ts`: enable callback failure: ~tp",
[FeatureName, Reason]),
[FeatureName, Reason],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
{error, Reason}
end.

Expand All @@ -169,9 +175,10 @@ listener_records_in_ets_enable(#{feature_name := FeatureName}) ->
throw:{error, {no_exists, rabbit_listener}} ->
ok;
throw:{error, Reason} ->
rabbit_log_feature_flags:error(
?LOG_ERROR(
"Feature flags: `~ts`: failed to migrate Mnesia table: ~tp",
[FeatureName, Reason]),
[FeatureName, Reason],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
{error, Reason}
end.

Expand All @@ -183,16 +190,18 @@ listener_records_in_ets_post_enable(#{feature_name := FeatureName}) ->
{aborted, {no_exists, _}} ->
ok;
{aborted, Err} ->
rabbit_log_feature_flags:error(
?LOG_ERROR(
"Feature flags: `~ts`: failed to delete Mnesia table: ~tp",
[FeatureName, Err]),
[FeatureName, Err],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
ok
end
catch
throw:{error, Reason} ->
rabbit_log_feature_flags:error(
?LOG_ERROR(
"Feature flags: `~ts`: failed to delete Mnesia table: ~tp",
[FeatureName, Reason]),
[FeatureName, Reason],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
ok
end.

Expand All @@ -204,8 +213,10 @@ tracking_records_in_ets_enable(#{feature_name := FeatureName}) ->
throw:{error, {no_exists, _}} ->
ok;
throw:{error, Reason} ->
rabbit_log_feature_flags:error("Enabling feature flag ~ts failed: ~tp",
[FeatureName, Reason]),
?LOG_ERROR(
"Enabling feature flag ~ts failed: ~tp",
[FeatureName, Reason],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
{error, Reason}
end.

Expand All @@ -217,8 +228,10 @@ tracking_records_in_ets_post_enable(#{feature_name := FeatureName}) ->
Tab <- rabbit_channel_tracking:get_all_tracked_channel_table_names_for_node(node())]
catch
throw:{error, Reason} ->
rabbit_log_feature_flags:error("Enabling feature flag ~ts failed: ~tp",
[FeatureName, Reason]),
?LOG_ERROR(
"Enabling feature flag ~ts failed: ~tp",
[FeatureName, Reason],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
%% adheres to the callback interface
ok
end.
Expand All @@ -230,8 +243,10 @@ delete_table(FeatureName, Tab) ->
{aborted, {no_exists, _}} ->
ok;
{aborted, Err} ->
rabbit_log_feature_flags:error("Enabling feature flag ~ts failed to delete mnesia table ~tp: ~tp",
[FeatureName, Tab, Err]),
?LOG_ERROR(
"Enabling feature flag ~ts failed to delete mnesia table ~tp: ~tp",
[FeatureName, Tab, Err],
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
%% adheres to the callback interface
ok
end.
Loading