summaryrefslogtreecommitdiff
path: root/src
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
commit22664aff3de92f696398d31a2ce05ca6eb27c7f5 (patch)
tree43cfdc0aa0bff1d71b39b9ed0d2d3fafaa08e00b /src
parent244b20793c1a122d44aa4ce8522181147c6695aa (diff)
downloadrabbitmq-server-git-22664aff3de92f696398d31a2ce05ca6eb27c7f5.tar.gz
Table locking -> O(n)
Diffstat (limited to 'src')
-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 f4cab5115a..dd1e0d9d48 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)],