Skip to content

Introduce deprecated features management #7390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2023
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
8 changes: 8 additions & 0 deletions deps/rabbit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ rabbitmq_integration_suite(
size = "medium",
)

rabbitmq_integration_suite(
name = "deprecated_features_SUITE",
size = "medium",
additional_beam = [
":feature_flags_v2_SUITE_beam_files",
],
)

rabbitmq_integration_suite(
name = "disconnect_detected_during_alarm_SUITE",
size = "medium",
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ ct-slow: CT_SUITES = $(SLOW_CT_SUITES)
# --------------------------------------------------------------------

RMQ_ERLC_OPTS += -I $(DEPS_DIR)/rabbit_common/include
EDOC_OPTS += {preprocess,true}
EDOC_OPTS += {preprocess,true},{includes,["."]}

ifdef INSTRUMENT_FOR_QC
RMQ_ERLC_OPTS += -DINSTR_MOD=gm_qc
Expand Down
12 changes: 12 additions & 0 deletions deps/rabbit/app.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def all_beam_files(name = "all_beam_files"):
"src/rabbit_definitions_hashing.erl",
"src/rabbit_definitions_import_https.erl",
"src/rabbit_definitions_import_local_filesystem.erl",
"src/rabbit_deprecated_features.erl",
"src/rabbit_diagnostics.erl",
"src/rabbit_direct.erl",
"src/rabbit_direct_reply_to.erl",
Expand Down Expand Up @@ -338,6 +339,7 @@ def all_test_beam_files(name = "all_test_beam_files"):
"src/rabbit_definitions_hashing.erl",
"src/rabbit_definitions_import_https.erl",
"src/rabbit_definitions_import_local_filesystem.erl",
"src/rabbit_deprecated_features.erl",
"src/rabbit_diagnostics.erl",
"src/rabbit_direct.erl",
"src/rabbit_direct_reply_to.erl",
Expand Down Expand Up @@ -512,6 +514,7 @@ def all_srcs(name = "all_srcs"):
filegroup(
name = "private_hdrs",
srcs = [
"src/rabbit_feature_flags.hrl",
"src/rabbit_fifo.hrl",
"src/rabbit_fifo_dlx.hrl",
"src/rabbit_fifo_v0.hrl",
Expand Down Expand Up @@ -593,6 +596,7 @@ def all_srcs(name = "all_srcs"):
"src/rabbit_definitions_hashing.erl",
"src/rabbit_definitions_import_https.erl",
"src/rabbit_definitions_import_local_filesystem.erl",
"src/rabbit_deprecated_features.erl",
"src/rabbit_diagnostics.erl",
"src/rabbit_direct.erl",
"src/rabbit_direct_reply_to.erl",
Expand Down Expand Up @@ -878,6 +882,14 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
erlc_opts = "//:test_erlc_opts",
deps = ["//deps/rabbit_common:erlang_app"],
)
erlang_bytecode(
name = "deprecated_features_SUITE_beam_files",
testonly = True,
srcs = ["test/deprecated_features_SUITE.erl"],
outs = ["test/deprecated_features_SUITE.beam"],
app_name = "rabbit",
erlc_opts = "//:test_erlc_opts",
)
erlang_bytecode(
name = "direct_exchange_routing_v2_SUITE_beam_files",
testonly = True,
Expand Down
19 changes: 19 additions & 0 deletions deps/rabbit/docs/rabbitmq.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,25 @@
## NB: Change these only if you understand what you are doing!
##

## To permit or deny a deprecated feature when it is in its
## `permitted_by_default` or `denied_by_default` deprecation phase, the
## default state can be overriden from the configuration.
##
## When a deprecated feature is permitted by default (first phase of the
## deprecation period), it means the feature is available by default and can
## be turned off by setting it to false in the configuration.
##
## When a deprecated feature is denied by default (second phase of the
## deprecation period), it means the feature is unavailable by default but can
## be turned back on by setting it to true in the configuration.
##
## When a deprecated feature is "disconnected" or "removed" (last two phases
## of the deprecation period), it is no longer possible to turn it back on
## from the configuration.
##
# deprecated_features.permit.a_deprecated_feature = true
# deprecated_features.permit.another_deprecated_feature = false

## Timeout used when waiting for Mnesia tables in a cluster to
## become available.
##
Expand Down
13 changes: 6 additions & 7 deletions deps/rabbit/priv/schema/rabbit.schema
Original file line number Diff line number Diff line change
Expand Up @@ -2131,18 +2131,17 @@ end}.
%% =====================================
%%

%% NOTE: `true` is intentionally omitted - add it back when mirrored
%% queue deprecation is converted to use deprecated features system.
{mapping,
"deprecated_features.permit.$name", "rabbit.permitted_deprecated_features",
[{datatype, {enum, [false]}}]
"deprecated_features.permit.$name", "rabbit.permit_deprecated_features",
[{datatype, {enum, [true, false]}}]
}.

%% This converts:
%% deprecated_features.permit.my_feature = false
%% deprecated_features.permit.my_feature = true
%% to:
%% {rabbit, [{permitted_deprecated_features, #{my_feature => false}}]}.
{translation, "rabbit.permitted_deprecated_features",
%% {rabbit, [{permit_deprecated_features, #{my_feature => true}}]}.

{translation, "rabbit.permit_deprecated_features",
fun(Conf) ->
Settings = cuttlefish_variable:filter_by_prefix(
"deprecated_features.permit", Conf),
Expand Down
10 changes: 8 additions & 2 deletions deps/rabbit/src/rabbit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,10 @@ 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(),
case rabbit_feature_flags:refresh_feature_flags_after_app_load() of
ok -> ok;
Error -> throw(Error)
end,
rabbit_prelaunch_conf:decrypt_config(Apps),
lists:foreach(
fun(App) ->
Expand Down Expand Up @@ -932,7 +935,10 @@ 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(),
case rabbit_feature_flags:refresh_feature_flags_after_app_load() of
ok -> ok;
Error1 -> throw(Error1)
end,

persist_static_configuration(),

Expand Down
Loading