Skip to content

Commit 3da59e0

Browse files
Merge pull request #12841 from rabbitmq/mergify/bp/v4.0.x/pr-12840
Fix transient queue detection (backport #12840)
2 parents bfdc57f + 6459e02 commit 3da59e0

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

deps/rabbit/src/rabbit_amqqueue.erl

+13-6
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,19 @@
118118
}}).
119119

120120
are_transient_nonexcl_used(_) ->
121-
case rabbit_db_queue:list_transient() of
122-
{ok, Queues} ->
123-
NonExclQueues = [Q || Q <- Queues, not is_exclusive(Q)],
124-
length(NonExclQueues) > 0;
125-
{error, _} ->
126-
undefined
121+
case rabbit_db:is_virgin_node() of
122+
true ->
123+
%% a virgin node can't have any queues and the check is performed before
124+
%% metadata store is ready, so skip the query
125+
false;
126+
false ->
127+
case rabbit_db_queue:list_transient() of
128+
{ok, Queues} ->
129+
NonExclQueues = [Q || Q <- Queues, not is_exclusive(Q)],
130+
length(NonExclQueues) > 0;
131+
{error, _} ->
132+
undefined
133+
end
127134
end.
128135

129136
-define(CONSUMER_INFO_KEYS,

deps/rabbit/src/rabbit_db_queue.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ list_transient() ->
985985
}).
986986

987987
list_transient_in_mnesia() ->
988-
Pattern = amqqueue:pattern_match_all(),
988+
Pattern = amqqueue:pattern_match_on_durable(false),
989989
AllQueues = mnesia:dirty_match_object(
990990
?MNESIA_TABLE,
991991
Pattern),

0 commit comments

Comments
 (0)