Skip to content

Commit 103efec

Browse files
authored
Merge pull request #6810 from rabbitmq/make-feature_flags_v2-required
Feature flags: Make feature flags v2 required
2 parents aa02e32 + c590db6 commit 103efec

14 files changed

+293
-2033
lines changed

deps/rabbit/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ suites = [
429429
name = "feature_flags_SUITE",
430430
size = "large",
431431
flaky = True,
432-
shard_count = 9,
432+
shard_count = 5,
433433
runtime_deps = [
434434
"//deps/rabbit/test/feature_flags_SUITE_data/my_plugin:erlang_app",
435435
],

deps/rabbit/src/rabbit.erl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ start_apps(Apps, RestartTypes) ->
521521
%% We need to load all applications involved in order to be able to
522522
%% find new feature flags.
523523
app_utils:load_applications(Apps),
524-
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(Apps),
524+
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(),
525525
rabbit_prelaunch_conf:decrypt_config(Apps),
526526
lists:foreach(
527527
fun(App) ->
@@ -908,8 +908,7 @@ start(normal, []) ->
908908
%% once, because it does not involve running code from the
909909
%% plugins.
910910
ok = app_utils:load_applications(Plugins),
911-
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(
912-
Plugins),
911+
ok = rabbit_feature_flags:refresh_feature_flags_after_app_load(),
913912

914913
persist_static_configuration(),
915914

deps/rabbit/src/rabbit_core_ff.erl

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
-module(rabbit_core_ff).
99

10+
-include_lib("kernel/include/logger.hrl").
11+
12+
-include_lib("rabbit_common/include/logging.hrl").
13+
1014
-export([direct_exchange_routing_v2_enable/1,
1115
listener_records_in_ets_enable/1,
1216
listener_records_in_ets_post_enable/1,
@@ -70,7 +74,7 @@
7074
-rabbit_feature_flag(
7175
{feature_flags_v2,
7276
#{desc => "Feature flags subsystem V2",
73-
stability => stable
77+
stability => required
7478
}}).
7579

7680
-rabbit_feature_flag(
@@ -136,16 +140,18 @@ direct_exchange_routing_v2_enable(#{feature_name := FeatureName}) ->
136140
ok ->
137141
ok = rabbit_binding:populate_index_route_table();
138142
{error, Err} = Error ->
139-
rabbit_log_feature_flags:error(
143+
?LOG_ERROR(
140144
"Feature flags: `~ts`: failed to add copy of table ~ts to "
141145
"node ~tp: ~tp",
142-
[FeatureName, TableName, node(), Err]),
146+
[FeatureName, TableName, node(), Err],
147+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
143148
Error
144149
end
145150
catch throw:{error, Reason} ->
146-
rabbit_log_feature_flags:error(
151+
?LOG_ERROR(
147152
"Feature flags: `~ts`: enable callback failure: ~tp",
148-
[FeatureName, Reason]),
153+
[FeatureName, Reason],
154+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
149155
{error, Reason}
150156
end.
151157

@@ -169,9 +175,10 @@ listener_records_in_ets_enable(#{feature_name := FeatureName}) ->
169175
throw:{error, {no_exists, rabbit_listener}} ->
170176
ok;
171177
throw:{error, Reason} ->
172-
rabbit_log_feature_flags:error(
178+
?LOG_ERROR(
173179
"Feature flags: `~ts`: failed to migrate Mnesia table: ~tp",
174-
[FeatureName, Reason]),
180+
[FeatureName, Reason],
181+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
175182
{error, Reason}
176183
end.
177184

@@ -183,16 +190,18 @@ listener_records_in_ets_post_enable(#{feature_name := FeatureName}) ->
183190
{aborted, {no_exists, _}} ->
184191
ok;
185192
{aborted, Err} ->
186-
rabbit_log_feature_flags:error(
193+
?LOG_ERROR(
187194
"Feature flags: `~ts`: failed to delete Mnesia table: ~tp",
188-
[FeatureName, Err]),
195+
[FeatureName, Err],
196+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
189197
ok
190198
end
191199
catch
192200
throw:{error, Reason} ->
193-
rabbit_log_feature_flags:error(
201+
?LOG_ERROR(
194202
"Feature flags: `~ts`: failed to delete Mnesia table: ~tp",
195-
[FeatureName, Reason]),
203+
[FeatureName, Reason],
204+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
196205
ok
197206
end.
198207

@@ -204,8 +213,10 @@ tracking_records_in_ets_enable(#{feature_name := FeatureName}) ->
204213
throw:{error, {no_exists, _}} ->
205214
ok;
206215
throw:{error, Reason} ->
207-
rabbit_log_feature_flags:error("Enabling feature flag ~ts failed: ~tp",
208-
[FeatureName, Reason]),
216+
?LOG_ERROR(
217+
"Enabling feature flag ~ts failed: ~tp",
218+
[FeatureName, Reason],
219+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
209220
{error, Reason}
210221
end.
211222

@@ -217,8 +228,10 @@ tracking_records_in_ets_post_enable(#{feature_name := FeatureName}) ->
217228
Tab <- rabbit_channel_tracking:get_all_tracked_channel_table_names_for_node(node())]
218229
catch
219230
throw:{error, Reason} ->
220-
rabbit_log_feature_flags:error("Enabling feature flag ~ts failed: ~tp",
221-
[FeatureName, Reason]),
231+
?LOG_ERROR(
232+
"Enabling feature flag ~ts failed: ~tp",
233+
[FeatureName, Reason],
234+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
222235
%% adheres to the callback interface
223236
ok
224237
end.
@@ -230,8 +243,10 @@ delete_table(FeatureName, Tab) ->
230243
{aborted, {no_exists, _}} ->
231244
ok;
232245
{aborted, Err} ->
233-
rabbit_log_feature_flags:error("Enabling feature flag ~ts failed to delete mnesia table ~tp: ~tp",
234-
[FeatureName, Tab, Err]),
246+
?LOG_ERROR(
247+
"Enabling feature flag ~ts failed to delete mnesia table ~tp: ~tp",
248+
[FeatureName, Tab, Err],
249+
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}),
235250
%% adheres to the callback interface
236251
ok
237252
end.

0 commit comments

Comments
 (0)