Skip to content

Commit

Permalink
Merge pull request #6638 from rabbitmq/unused-buggy-apply_defs_5
Browse files Browse the repository at this point in the history
Remove unused rabbit_definitions:apply_defs/5
  • Loading branch information
michaelklishin committed Dec 12, 2022
2 parents 4ddcab2 + aa0104c commit f216ecc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 50 deletions.
40 changes: 1 addition & 39 deletions deps/rabbit/src/rabbit_definitions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
%% import
-export([import_raw/1, import_raw/2, import_parsed/1, import_parsed/2,
import_parsed_with_hashing/1, import_parsed_with_hashing/2,
apply_defs/2, apply_defs/3, apply_defs/4, apply_defs/5,
apply_defs/2, apply_defs/3,
should_skip_if_unchanged/0]).

-export([all_definitions/0]).
Expand Down Expand Up @@ -465,44 +465,6 @@ apply_defs(Map, ActingUser, SuccessFun, VHost) when is_function(SuccessFun); is_
rabbit_runtime:gc_all_processes()
end.

-spec apply_defs(Map :: #{atom() => any()},
ActingUser :: rabbit_types:username(),
SuccessFun :: fun(() -> 'ok'),
ErrorFun :: fun((any()) -> 'ok'),
VHost :: vhost:name()) -> 'ok' | {error, term()}.

apply_defs(Map, ActingUser, SuccessFun, ErrorFun, VHost) ->
rabbit_log:info("Asked to import definitions for a virtual host. Virtual host: ~tp, acting user: ~tp",
[VHost, ActingUser]),
try
validate_limits(Map, VHost),

concurrent_for_all(bindings, ActingUser, Map, VHost, fun add_binding/3),
sequential_for_all(parameters, ActingUser, Map, VHost, fun add_parameter/3),
%% importing policies concurrently can be unsafe as queues will be getting
%% potentially out of order notifications of applicable policy changes
sequential_for_all(policies, ActingUser, Map, VHost, fun add_policy/3),

rabbit_nodes:if_reached_target_cluster_size(
fun() ->
concurrent_for_all(queues, ActingUser, Map, VHost, fun add_queue/3),
concurrent_for_all(bindings, ActingUser, Map, VHost, fun add_binding/3)
end,

fun() ->
rabbit_log:info("There are fewer than target cluster size (~b) nodes online,"
" skipping queue and binding import from definitions",
[rabbit_nodes:target_cluster_size_hint()])
end
),

SuccessFun()
catch {error, E} -> ErrorFun(format(E));
exit:E -> ErrorFun(format(E))
after
rabbit_runtime:gc_all_processes()
end.

sequential_for_all(Category, ActingUser, Definitions, Fun) ->
try
sequential_for_all0(Category, ActingUser, Definitions, Fun)
Expand Down
11 changes: 0 additions & 11 deletions deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
-export([accept_multipart/2]).
-export([variances/2]).

-export([apply_defs/3, apply_defs/5]).

-import(rabbit_misc, [pget/2]).

-include("rabbit_mgmt.hrl").
Expand Down Expand Up @@ -211,15 +209,6 @@ apply_defs(Body, ActingUser) ->
apply_defs(Body, ActingUser, VHost) ->
rabbit_definitions:apply_defs(Body, ActingUser, VHost).

-spec apply_defs(Map :: #{atom() => any()},
ActingUser :: rabbit_types:username(),
SuccessFun :: fun(() -> 'ok'),
ErrorFun :: fun((any()) -> 'ok'),
VHost :: vhost:name()) -> 'ok' | {error, term()}.

apply_defs(Body, ActingUser, SuccessFun, ErrorFun, VHost) ->
rabbit_definitions:apply_defs(Body, ActingUser, SuccessFun, ErrorFun, VHost).

get_all_parts(Req) ->
get_all_parts(Req, []).

Expand Down

0 comments on commit f216ecc

Please sign in to comment.