Merge pull request #13628 from rabbitmq/ik-13620-shovel-forward-counter-followup
RMQ-1263: An attempt to make shovel status tuple handling backwards compatible
This commit is contained in:
commit
9439756d62
|
@ -76,8 +76,14 @@ run([Name], #{node := Node, vhost := VHost}) ->
|
|||
undefined ->
|
||||
try_force_removing(Node, VHost, Name, ActingUser),
|
||||
{error, rabbit_data_coercion:to_binary(ErrMsg)};
|
||||
Match ->
|
||||
{{_Name, _VHost}, _Type, {_State, Opts}, _Metrics, _Timestamp} = Match,
|
||||
{{_Name, _VHost}, _Type, {_State, Opts}, _Metrics, _Timestamp} ->
|
||||
delete_shovel(ErrMsg, VHost, Name, ActingUser, Opts, Node);
|
||||
{{_Name, _VHost}, _Type, {_State, Opts}, _Timestamp} ->
|
||||
delete_shovel(ErrMsg, VHost, Name, ActingUser, Opts, Node)
|
||||
end
|
||||
end.
|
||||
|
||||
delete_shovel(ErrMsg, VHost, Name, ActingUser, Opts, Node) ->
|
||||
{_, HostingNode} = lists:keyfind(node, 1, Opts),
|
||||
case rabbit_misc:rpc_call(
|
||||
HostingNode, rabbit_shovel_util, delete_shovel, [VHost, Name, ActingUser]) of
|
||||
|
@ -89,8 +95,6 @@ run([Name], #{node := Node, vhost := VHost}) ->
|
|||
ok ->
|
||||
_ = try_clearing_runtime_parameter(Node, VHost, Name, ActingUser),
|
||||
ok
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
||||
switches() ->
|
||||
|
|
|
@ -62,8 +62,14 @@ run([Name], #{node := Node, vhost := VHost}) ->
|
|||
case rabbit_shovel_status:find_matching_shovel(VHost, Name, Xs) of
|
||||
undefined ->
|
||||
{error, rabbit_data_coercion:to_binary(ErrMsg)};
|
||||
Match ->
|
||||
{{_Name, _VHost}, _Type, {_State, Opts}, _Metrics, _Timestamp} = Match,
|
||||
{{_Name, _VHost}, _Type, {_State, Opts}, _Metrics, _Timestamp} ->
|
||||
restart_shovel(ErrMsg, Name, VHost, Opts);
|
||||
{{_Name, _VHost}, _Type, {_State, Opts}, _Timestamp} ->
|
||||
restart_shovel(ErrMsg, Name, VHost, Opts)
|
||||
end
|
||||
end.
|
||||
|
||||
restart_shovel(ErrMsg, Name, VHost, Opts) ->
|
||||
{_, HostingNode} = lists:keyfind(node, 1, Opts),
|
||||
case rabbit_misc:rpc_call(
|
||||
HostingNode, rabbit_shovel_util, restart_shovel, [VHost, Name]) of
|
||||
|
@ -72,8 +78,6 @@ run([Name], #{node := Node, vhost := VHost}) ->
|
|||
{error, not_found} ->
|
||||
{error, rabbit_data_coercion:to_binary(ErrMsg)};
|
||||
ok -> ok
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
||||
output(Output, _Opts) ->
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
pending := rabbit_types:option(non_neg_integer()),
|
||||
forwarded := rabbit_types:option(non_neg_integer())
|
||||
} | #{}.
|
||||
-type status_tuple() :: {name(), type(), info(), metrics(), calendar:datetime()}.
|
||||
-type status_tuple_41x() :: {name(), type(), info(), metrics(), calendar:datetime()}.
|
||||
-type status_tuple_40x_and_older() :: {name(), type(), info(), calendar:datetime()}.
|
||||
-type status_tuple() :: status_tuple_41x() | status_tuple_40x_and_older().
|
||||
|
||||
-export_type([info/0, blocked_status/0, shovel_status/0, metrics/0]).
|
||||
|
||||
|
|
|
@ -43,6 +43,10 @@ status(Node) ->
|
|||
end.
|
||||
|
||||
format(Node, {Name, Type, Info, _Metrics, TS}) ->
|
||||
[{node, Node}, {timestamp, format_ts(TS)}] ++
|
||||
format_name(Type, Name) ++
|
||||
format_info(Info);
|
||||
format(Node, {Name, Type, Info, TS}) ->
|
||||
[{node, Node}, {timestamp, format_ts(TS)}] ++
|
||||
format_name(Type, Name) ++
|
||||
format_info(Info).
|
||||
|
|
Loading…
Reference in New Issue