Skip to content

Commit 6ccea5b

Browse files
mkuratczykmergify[bot]
authored andcommitted
Speed up shovel start and cleanup
The filtering was incorrect, so we ended up trying to delete all existing shovels. Running shovels would reject the attempt, so things generally worked as expected, but this redundant work was quite costly. In a test with 1000 shovels, this change speeds up a definition import from a few minutes to a few seconds. Fixes https://github.com/rabbitmq/rabbitmq-server/discussions/9714 Fixes #8364 (cherry picked from commit 015be93) # Conflicts: # deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl
1 parent 152fd1f commit 6ccea5b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,18 @@ stop_child({VHost, ShovelName} = Name) ->
8383
%% See rabbit_shovel_worker:terminate/2
8484

8585
cleanup_specs() ->
86+
<<<<<<< HEAD
8687
SpecsSet = sets:from_list([element(1, S) || S <- mirrored_supervisor:which_children(?SUPERVISOR)]),
8788
ParamsSet = sets:from_list(rabbit_runtime_parameters:list_component(<<"shovel">>)),
8889
F = fun(Spec, ok) ->
8990
_ = mirrored_supervisor:delete_child(?SUPERVISOR, Spec),
91+
=======
92+
SpecsSet = sets:from_list([element(2, element(1, S)) || S <- mirrored_supervisor:which_children(?SUPERVISOR)]),
93+
ParamsSet = sets:from_list([ {proplists:get_value(vhost, S), proplists:get_value(name, S)}
94+
|| S <- rabbit_runtime_parameters:list_component(<<"shovel">>) ]),
95+
F = fun(Name, ok) ->
96+
_ = mirrored_supervisor:delete_child(?SUPERVISOR, id(Name)),
97+
>>>>>>> 015be9336c (Speed up shovel start and cleanup)
9098
ok
9199
end,
92100
ok = sets:fold(F, ok, sets:subtract(SpecsSet, ParamsSet)).

0 commit comments

Comments
 (0)