summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_exchange.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index a8c54438..58b8d7d6 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -268,9 +268,17 @@ exchanges_for_queue(QueueName) ->
has_bindings(ExchangeName) ->
MatchHead = #route{binding = #binding{exchange_name = ExchangeName,
- queue_name = '$1',
_ = '_'}},
- continue(mnesia:select(route, [{MatchHead, [], ['$1']}], 1, read)).
+ try
+ continue(mnesia:select(route, [{MatchHead, [], ['$_']}], 1, read))
+ catch exit:{aborted, {badarg, _}} ->
+ %% work around OTP-7025, which was fixed in R12B-1, by
+ %% falling back on a less efficient method
+ case mnesia:match_object(MatchHead) of
+ [] -> false;
+ [_|_] -> true
+ end
+ end.
continue('$end_of_table') -> false;
continue({[_|_], _}) -> true;