diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-04-08 18:10:19 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-04-08 18:10:19 +0100 |
| commit | e48006cf4298ec2be31125246cf8f6d669f7da44 (patch) | |
| tree | 632a37800d36e676e7116059902fd129ed920fd4 /src | |
| parent | a164bb8c72406a9573e1c45072c03c34e841b0aa (diff) | |
| download | rabbitmq-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.erl | 25 |
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) -> |
