Merge pull request #10586 from rabbitmq/qq-file-handle-reservation-defensiveness

QQ: be more defensive when reserving file handles.
This commit is contained in:
Michael Klishin 2024-02-20 16:32:05 -05:00 committed by GitHub
commit 3dd3b69607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -1396,9 +1396,16 @@ is_match(Subj, E) ->
nomatch /= re:run(Subj, E).
file_handle_leader_reservation(QName) ->
{ok, Q} = rabbit_amqqueue:lookup(QName),
ClusterSize = length(get_nodes(Q)),
file_handle_cache:set_reservation(2 + ClusterSize).
try
{ok, Q} = rabbit_amqqueue:lookup(QName),
ClusterSize = length(get_nodes(Q)),
file_handle_cache:set_reservation(2 + ClusterSize)
catch Class:Err ->
rabbit_log:warning("~s:~s/~b failed with ~w ~w",
[?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY,
Class, Err])
end.
file_handle_other_reservation() ->
file_handle_cache:set_reservation(2).