summaryrefslogtreecommitdiff
path: root/src/rabbit_msg_store.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-10-15 12:27:36 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2011-10-15 12:27:36 +0100
commit751c3268c5f9e8353370abdc804108bdc80e4fc0 (patch)
tree782bcebdd77f57a89808dfef6bf02ebf2554e955 /src/rabbit_msg_store.erl
parent6afd557d6abc7a284f210e598ac2dbb3bd7089b9 (diff)
parent95294ae2cad14081b1163ed6461609c6f58c18d8 (diff)
downloadrabbitmq-server-751c3268c5f9e8353370abdc804108bdc80e4fc0.tar.gz
merge default into bug24308
Diffstat (limited to 'src/rabbit_msg_store.erl')
-rw-r--r--src/rabbit_msg_store.erl21
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
%%----------------------------------------------------------------------------