diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-15 12:27:36 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-10-15 12:27:36 +0100 |
commit | 751c3268c5f9e8353370abdc804108bdc80e4fc0 (patch) | |
tree | 782bcebdd77f57a89808dfef6bf02ebf2554e955 /src/rabbit_msg_store.erl | |
parent | 6afd557d6abc7a284f210e598ac2dbb3bd7089b9 (diff) | |
parent | 95294ae2cad14081b1163ed6461609c6f58c18d8 (diff) | |
download | rabbitmq-server-751c3268c5f9e8353370abdc804108bdc80e4fc0.tar.gz |
merge default into bug24308
Diffstat (limited to 'src/rabbit_msg_store.erl')
-rw-r--r-- | src/rabbit_msg_store.erl | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index f3056cd4..1a26a200 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -1178,6 +1178,14 @@ safe_ets_update_counter(Tab, Key, UpdateOp, SuccessFun, FailThunk) -> catch error:badarg -> FailThunk() end. +update_msg_cache(CacheEts, MsgId, Msg) -> + case ets:insert_new(CacheEts, {MsgId, Msg, 1}) of + true -> ok; + false -> safe_ets_update_counter( + CacheEts, MsgId, {3, +1}, fun (_) -> ok end, + fun () -> update_msg_cache(CacheEts, MsgId, Msg) end) + end. + adjust_valid_total_size(File, Delta, State = #msstate { sum_valid_data = SumValid, file_summary_ets = FileSummaryEts }) -> @@ -1368,19 +1376,6 @@ list_sorted_file_names(Dir, Ext) -> filelib:wildcard("*" ++ Ext, Dir)). %%---------------------------------------------------------------------------- -%% message cache helper functions -%%---------------------------------------------------------------------------- - -update_msg_cache(CacheEts, MsgId, Msg) -> - case ets:insert_new(CacheEts, {MsgId, Msg, 1}) of - true -> true = undefined =/= Msg, %% ASSERTION - ok; - false -> safe_ets_update_counter( - CacheEts, MsgId, {3, +1}, fun (_) -> ok end, - fun () -> update_msg_cache(CacheEts, MsgId, Msg) end) - end. - -%%---------------------------------------------------------------------------- %% index %%---------------------------------------------------------------------------- |