Skip to content

Commit

Permalink
Merge pull request #12841 from rabbitmq/mergify/bp/v4.0.x/pr-12840
Browse files Browse the repository at this point in the history
Fix transient queue detection (backport #12840)
  • Loading branch information
michaelklishin authored Nov 28, 2024
2 parents bfdc57f + 6459e02 commit 3da59e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions deps/rabbit/src/rabbit_amqqueue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,19 @@
}}).

are_transient_nonexcl_used(_) ->
case rabbit_db_queue:list_transient() of
{ok, Queues} ->
NonExclQueues = [Q || Q <- Queues, not is_exclusive(Q)],
length(NonExclQueues) > 0;
{error, _} ->
undefined
case rabbit_db:is_virgin_node() of
true ->
%% a virgin node can't have any queues and the check is performed before
%% metadata store is ready, so skip the query
false;
false ->
case rabbit_db_queue:list_transient() of
{ok, Queues} ->
NonExclQueues = [Q || Q <- Queues, not is_exclusive(Q)],
length(NonExclQueues) > 0;
{error, _} ->
undefined
end
end.

-define(CONSUMER_INFO_KEYS,
Expand Down
2 changes: 1 addition & 1 deletion deps/rabbit/src/rabbit_db_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ list_transient() ->
}).

list_transient_in_mnesia() ->
Pattern = amqqueue:pattern_match_all(),
Pattern = amqqueue:pattern_match_on_durable(false),
AllQueues = mnesia:dirty_match_object(
?MNESIA_TABLE,
Pattern),
Expand Down

0 comments on commit 3da59e0

Please sign in to comment.