35
35
enable /1 ,
36
36
enable_default /0 ,
37
37
check_node_compatibility /1 ,
38
- sync_cluster /0 ,
38
+ sync_cluster /1 ,
39
39
refresh_after_app_load /0 ,
40
40
get_forced_feature_flag_names /0 ]).
41
41
@@ -134,21 +134,21 @@ check_node_compatibility(RemoteNode) ->
134
134
% % feature flags.
135
135
check_node_compatibility_task (ThisNode , RemoteNode ).
136
136
137
- sync_cluster () ->
137
+ sync_cluster (Nodes ) ->
138
138
? LOG_DEBUG (
139
139
" Feature flags: SYNCING FEATURE FLAGS in cluster..." ,
140
140
[],
141
141
#{domain => ? RMQLOG_DOMAIN_FEAT_FLAGS }),
142
142
case erlang :whereis (? LOCAL_NAME ) of
143
143
Pid when is_pid (Pid ) ->
144
144
% % The function is called while `rabbit' is running.
145
- gen_statem :call (? LOCAL_NAME , sync_cluster );
145
+ gen_statem :call (? LOCAL_NAME , { sync_cluster , Nodes } );
146
146
undefined ->
147
147
% % The function is called while `rabbit' is stopped. We need to
148
148
% % start a one-off controller, again to make sure concurrent
149
149
% % changes are blocked.
150
150
{ok , Pid } = start_link (),
151
- Ret = gen_statem :call (Pid , sync_cluster ),
151
+ Ret = gen_statem :call (Pid , { sync_cluster , Nodes } ),
152
152
gen_statem :stop (Pid ),
153
153
Ret
154
154
end .
@@ -273,8 +273,8 @@ proceed_with_task({enable, FeatureNames}) ->
273
273
enable_task (FeatureNames );
274
274
proceed_with_task (enable_default ) ->
275
275
enable_default_task ();
276
- proceed_with_task (sync_cluster ) ->
277
- sync_cluster_task ();
276
+ proceed_with_task ({ sync_cluster , Nodes } ) ->
277
+ sync_cluster_task (Nodes );
278
278
proceed_with_task (refresh_after_app_load ) ->
279
279
refresh_after_app_load_task ().
280
280
@@ -645,6 +645,15 @@ get_forced_feature_flag_names_from_config() ->
645
645
Reason :: term ().
646
646
647
647
sync_cluster_task () ->
648
+ Nodes = running_nodes (),
649
+ sync_cluster_task (Nodes ).
650
+
651
+ - spec sync_cluster_task (Nodes ) -> Ret when
652
+ Nodes :: [node ()],
653
+ Ret :: ok | {error , Reason },
654
+ Reason :: term ().
655
+
656
+ sync_cluster_task (Nodes ) ->
648
657
% % We assume that a feature flag can only be enabled, not disabled.
649
658
% % Therefore this synchronization searches for feature flags enabled on
650
659
% % some nodes but not all, and make sure they are enabled everywhere.
@@ -657,7 +666,6 @@ sync_cluster_task() ->
657
666
% % would make sure a feature flag isn't enabled while there is a network
658
667
% % partition. On the other hand, this would require that all nodes are
659
668
% % running before we can expand the cluster...
660
- Nodes = running_nodes (),
661
669
? LOG_DEBUG (
662
670
" Feature flags: synchronizing feature flags on nodes: ~p " ,
663
671
[Nodes ],
0 commit comments