diff options
| author | Jean-Sébastien Pédron <jean-sebastien.pedron@dumbbell.fr> | 2021-05-19 15:43:08 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2021-11-30 14:41:07 +0100 |
| commit | d5cba0a57e93e596307fdb16fee1257db40a4df1 (patch) | |
| tree | c1e1654d21bff5175a2959baa67f56c3038919a7 | |
| parent | 051e504f8eeb6a856c983586f271cdede1452670 (diff) | |
| download | rabbitmq-server-git-d5cba0a57e93e596307fdb16fee1257db40a4df1.tar.gz | |
Feature flags: Only enable stable feature flags on a virgin node
Before this change, all feature flags were enabled by default when a new
node was started. Now, only the stable ones are enabled, not the
experimental ones. In other words, experimental feature flags must be
enabled explicitely.
| -rw-r--r-- | deps/rabbit/src/rabbit_feature_flags.erl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/deps/rabbit/src/rabbit_feature_flags.erl b/deps/rabbit/src/rabbit_feature_flags.erl index 66e9dd49eb..d0e6065106 100644 --- a/deps/rabbit/src/rabbit_feature_flags.erl +++ b/deps/rabbit/src/rabbit_feature_flags.erl @@ -82,6 +82,7 @@ list/2, enable/1, enable_all/0, + enable_all/1, disable/1, disable_all/0, is_supported/1, @@ -338,6 +339,21 @@ enable(FeatureNames) when is_list(FeatureNames) -> enable_all() -> with_feature_flags(maps:keys(list(all)), fun enable/1). +-spec enable_all(stability()) -> ok | {error, any()}. +%% @doc +%% Enables all supported feature flags matching the given stability. +%% +%% @param Stability The level of stability used to filter the feature flags to +%% enable. +%% @returns `ok' if the feature flags were successfully enabled, +%% or `{error, Reason}' if one feature flag could not be enabled +%% (subsequent feature flags in the dependency tree are left +%% unchanged). + +enable_all(Stability) + when Stability =:= stable orelse Stability =:= experimental -> + with_feature_flags(maps:keys(list(all, Stability)), fun enable/1). + -spec disable(feature_name() | [feature_name()]) -> ok | {error, any()}. %% @doc %% Disables the specified feature flag or set of feature flags. @@ -2087,9 +2103,9 @@ sync_feature_flags_with_cluster([], NodeIsVirgin, _) -> [] when FeatureNames =:= undefined -> rabbit_log_feature_flags:debug( "Feature flags: starting an unclustered node " - "for the first time: all feature flags will be " - "enabled by default"), - enable_all(); + "for the first time: all stable feature flags " + "will be enabled by default"), + enable_all(stable); [] -> case FeatureNames of [] -> |
