diff options
Diffstat (limited to 'src/rabbit_msg_store.erl')
-rw-r--r-- | src/rabbit_msg_store.erl | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 6c968ae4..5b308fe4 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -629,17 +629,16 @@ handle_cast({write, Guid}, not_found -> write_message(Guid, Msg, State); #msg_location { ref_count = 0, file = File, total_size = TotalSize } -> - [#file_summary { locked = Locked, - file_size = FileSize } = Summary] = - ets:lookup(FileSummaryEts, File), - case Locked of - true -> ok = index_delete(Guid, State), - write_message(Guid, Msg, State); - false -> ok = index_update_ref_count(Guid, 1, State), - ok = add_to_file_summary(Summary, TotalSize, FileSize, - State), - noreply(State #msstate { - sum_valid_data = SumValid + TotalSize }) + case ets:lookup(FileSummaryEts, File) of + [#file_summary { locked = true }] -> + ok = index_delete(Guid, State), + write_message(Guid, Msg, State); + [#file_summary { file_size = FileSize } = Summary] -> + ok = index_update_ref_count(Guid, 1, State), + ok = add_to_file_summary(Summary, TotalSize, FileSize, + State), + noreply(State #msstate { + sum_valid_data = SumValid + TotalSize }) end; #msg_location { ref_count = RefCount } -> %% We already know about it, just update counter. Only |