Skip to content

Commit

Permalink
Adapt rabbitmq#9909 for 3.12.x, references rabbitmq#9894
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin authored and gomoripeti committed Dec 8, 2023
1 parent 2a0322e commit 525c79f
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,14 @@ cleanup_specs() ->
|| S <- rabbit_runtime_parameters:list_component(<<"shovel">>) ]),
F = fun(Name, ok) ->
try
%% The supervisor operation is very unlikely to fail, it's the schema
%% data stores that can make a fuss about a non-existent or non-standard value passed in.
%% For example, an old style Shovel name is an invalid Khepri query path element. MK.
_ = mirrored_supervisor:delete_child(?SUPERVISOR, id(Name))
catch _:_:_Stacktrace ->
ok
end,
ok
end,
%% Khepri won't handle values in OldStyleSpecsSet in its path well. At the same time,
%% those older elements simply cannot exist in Khepri because having Khepri enabled
%% means a cluster-wide move to 3.13+, so we can conditionally compute what specs we care about. MK.
AllSpecs =
case rabbit_khepri:is_enabled() of
true -> NewStyleSpecsSet;
false -> sets:union(NewStyleSpecsSet, OldStyleSpecsSet)
end,
%% Try both formats to cover the transitionary mixed version cluster period.
AllSpecs = sets:union(NewStyleSpecsSet, OldStyleSpecsSet),
%% Delete any supervisor children that do not have their respective runtime parameters in the database.
SetToCleanUp = sets:subtract(AllSpecs, ParamsSet),
ok = sets:fold(F, ok, SetToCleanUp).
Expand All @@ -122,11 +113,7 @@ init([]) ->
{ok, {{one_for_one, 3, 10}, []}}.

id({V, S} = Name) ->
<<<<<<< HEAD
{[V, S], Name}.
=======
{[V, S], Name};
%% older format, pre 3.13.0 and 3.12.8. See rabbitmq/rabbitmq-server#9894
id(Other) ->
Other.
>>>>>>> 2ce0307641 (Dynamic Shovels: support old and new supervisor child ID formats)

0 comments on commit 525c79f

Please sign in to comment.