diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2011-11-30 11:14:21 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-11-30 11:14:21 +0000 |
| commit | 956d4e321634f387ec04805388538799b3c8b66d (patch) | |
| tree | 2e2de7915ece98821b9f0d6c9c52edef4fca95a5 | |
| parent | 2d651fe3732ae3497d5584d8e1a97968804f0ad0 (diff) | |
| download | rabbitmq-server-git-956d4e321634f387ec04805388538799b3c8b66d.tar.gz | |
only lock tables when we are dealing with multiple bindings
| -rw-r--r-- | src/rabbit_exchange_type_topic.erl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/rabbit_exchange_type_topic.erl b/src/rabbit_exchange_type_topic.erl index dcdaec2d3b..066744e138 100644 --- a/src/rabbit_exchange_type_topic.erl +++ b/src/rabbit_exchange_type_topic.erl @@ -73,12 +73,17 @@ remove_bindings(transaction, #exchange{name = X}, Bs) -> %% rows. The downside of all this is that no other binding %% operations except lookup/routing (which uses dirty ops) on %% topic exchanges can take place concurrently. However, that is - %% the case already since the removal of bindings from the - %% rabbit_route etc table, which precedes all this, uses - %% match_object with a partial key, which results in a table lock. - [mnesia:lock({table, T}, write) || T <- [rabbit_topic_trie_node, - rabbit_topic_trie_edge, - rabbit_topic_trie_binding]], + %% the case for any bulk binding removal operations since the + %% removal of bindings from the rabbit_route etc table, which + %% precedes all this, calls match_object with a partial key, which + %% results in a table lock. + case Bs of + [_] -> ok; + _ -> [mnesia:lock({table, T}, write) || + T <- [rabbit_topic_trie_node, + rabbit_topic_trie_edge, + rabbit_topic_trie_binding]] + end, %% The remove process is split into two distinct phases. In the %% first phase we gather the lists of bindings and edges to %% delete, then in the second phase we process all the |
