summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-04-08 18:10:19 +0100
committerSimon MacMullen <simon@rabbitmq.com>2011-04-08 18:10:19 +0100
commite48006cf4298ec2be31125246cf8f6d669f7da44 (patch)
tree632a37800d36e676e7116059902fd129ed920fd4 /src
parenta164bb8c72406a9573e1c45072c03c34e841b0aa (diff)
downloadrabbitmq-server-git-e48006cf4298ec2be31125246cf8f6d669f7da44.tar.gz
Don't cons inside the tx, prevents us from copying the accumulator on the way into the worker pool at great cost.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_misc.erl25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 85e08615c9..814a5bbcf2 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -467,17 +467,20 @@ map_in_order(F, L) ->
%% We ignore entries that have been modified or removed.
table_filter(Pred, PrePostCommitFun, TableName) ->
lists:foldl(
- fun (E, Acc) -> execute_mnesia_transaction(
- fun () -> case mnesia:match_object(TableName, E,
- read) of
- [] -> false;
- _ -> Pred(E)
- end
- end,
- fun (false, _Tx) -> Acc;
- (true, Tx) -> PrePostCommitFun(E, Tx),
- [E | Acc]
- end)
+ fun (E, Acc) -> case execute_mnesia_transaction(
+ fun () -> case mnesia:match_object(TableName, E,
+ read) of
+ [] -> false;
+ _ -> Pred(E)
+ end
+ end,
+ fun (false, _Tx) -> false;
+ (true, Tx) -> PrePostCommitFun(E, Tx),
+ true
+ end) of
+ false -> Acc;
+ true -> [E | Acc]
+ end
end, [], dirty_read_all(TableName)).
dirty_read_all(TableName) ->