summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-10-29 12:53:06 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-10-29 12:53:06 +0000
commitcd4eee76e7bb3ea7065603ca6df33eaeea392a3a (patch)
tree43cfdc0aa0bff1d71b39b9ed0d2d3fafaa08e00b
parent545e1d5c9eeb33d66ce3cc4cdeaafbae2869e6da (diff)
downloadrabbitmq-server-bug25846.tar.gz
Table locking -> O(n)bug25846
-rw-r--r--src/rabbit_policy.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rabbit_policy.erl b/src/rabbit_policy.erl
index f4cab511..dd1e0d9d 100644
--- a/src/rabbit_policy.erl
+++ b/src/rabbit_policy.erl
@@ -212,9 +212,15 @@ notify_clear(VHost, <<"policy">>, _Name) ->
%%----------------------------------------------------------------------------
+%% [1] We need to prevent this from becoming O(n^2) in a similar
+%% manner to rabbit_binding:remove_for_{source,destination}. So see
+%% the comment in rabbit_binding:lock_route_tables/0 for more rationale.
update_policies(VHost) ->
+ Tabs = [rabbit_queue, rabbit_durable_queue,
+ rabbit_exchange, rabbit_durable_exchange],
{Xs, Qs} = rabbit_misc:execute_mnesia_transaction(
fun() ->
+ [mnesia:lock({table, T}, write) || T <- Tabs], %% [1]
Policies = list(VHost),
{[update_exchange(X, Policies) ||
X <- rabbit_exchange:list(VHost)],