diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-04-11 01:20:44 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-04-11 01:20:44 +0100 |
| commit | 7ebf39380b09a0f0f7035f5b0a37f3717f53ded4 (patch) | |
| tree | b77ebd799409386992c50396e98d6a9540156733 /src | |
| parent | b8b9896cf79bc62bc0e11da85e23922e024342de (diff) | |
| download | rabbitmq-server-git-7ebf39380b09a0f0f7035f5b0a37f3717f53ded4.tar.gz | |
err, we only need to attempt compaction if we removed something!
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_disk_queue.erl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/rabbit_disk_queue.erl b/src/rabbit_disk_queue.erl index 8affd7aa96..2f27fc6b54 100644 --- a/src/rabbit_disk_queue.erl +++ b/src/rabbit_disk_queue.erl @@ -205,7 +205,7 @@ internal_ack(Q, MsgId, State = #dqstate { msg_location = MsgLocation, }) -> [{MsgId, RefCount, File, Offset, TotalSize}] = ets:lookup(MsgLocation, MsgId), % is this the last time we need the message, in which case tidy up - FileSummary1 = + State1 = if 1 =:= RefCount -> true = ets:delete(MsgLocation, MsgId), {ok, FileSum = #dqfile { valid_data = ValidTotalSize, @@ -214,17 +214,16 @@ internal_ack(Q, MsgId, State = #dqstate { msg_location = MsgLocation, = dict:find(File, FileSummary), FileDetail1 = dict:erase(Offset, FileDetail), ContiguousTop1 = lists:min([ContiguousTop, Offset]), - FileSummary2 = dict:store(File, FileSum #dqfile { valid_data = (ValidTotalSize - TotalSize - (?FILE_PACKING_ADJUSTMENT)), + FileSummary1 = dict:store(File, FileSum #dqfile { valid_data = (ValidTotalSize - TotalSize - (?FILE_PACKING_ADJUSTMENT)), contiguous_prefix = ContiguousTop1, detail = FileDetail1 }, FileSummary), ok = mnesia:dirty_delete({rabbit_disk_queue, {MsgId, Q}}), - FileSummary2; + compact(File, State # dqstate { file_summary = FileSummary1 } ); 1 < RefCount -> ets:insert(MsgLocation, {MsgId, RefCount - 1, File, Offset, TotalSize}), - FileSummary + State end, - State1 = compact(File, State # dqstate { file_summary = FileSummary1 } ), {ok, State1}. internal_tx_publish(MsgId, MsgBody, State = #dqstate { msg_location = MsgLocation, |
