diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2013-01-30 14:05:08 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-01-30 14:05:08 +0000 |
| commit | da3e951457e40a45d78f89995654e7434a3736c9 (patch) | |
| tree | a68ec84a832334be64f650dc4c1fe419537f166e /src | |
| parent | 3f15c30196f250ebb2d76e604a0bce7d72b2a056 (diff) | |
| download | rabbitmq-server-git-da3e951457e40a45d78f89995654e7434a3736c9.tar.gz | |
don't hold on to 'complete' in-memory qi journal entries
When a pub, del and ack for a message are all recorded in the journal
then we don't bother writing any of that to the segment files when the
journal is flushed, since the message is well and truly in the past
and forgotten. So... there is no point keeping the entry in the
in-memory journal either, where it just eats up space until a flush
for no good reason.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_queue_index.erl | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 7dc694586c..07117f9ab9 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -610,19 +610,21 @@ add_to_journal(RelSeq, Action, end}; add_to_journal(RelSeq, Action, JEntries) -> - Val = case array:get(RelSeq, JEntries) of - undefined -> - case Action of - ?PUB -> {Action, no_del, no_ack}; - del -> {no_pub, del, no_ack}; - ack -> {no_pub, no_del, ack} - end; - ({Pub, no_del, no_ack}) when Action == del -> - {Pub, del, no_ack}; - ({Pub, Del, no_ack}) when Action == ack -> - {Pub, Del, ack} - end, - array:set(RelSeq, Val, JEntries). + case array:get(RelSeq, JEntries) of + undefined -> + array:set(RelSeq, + case Action of + ?PUB -> {Action, no_del, no_ack}; + del -> {no_pub, del, no_ack}; + ack -> {no_pub, no_del, ack} + end, JEntries); + ({?PUB, del, no_ack}) when Action == ack -> + array:reset(RelSeq, JEntries); + ({Pub, no_del, no_ack}) when Action == del -> + array:set(RelSeq, {Pub, del, no_ack}, JEntries); + ({Pub, Del, no_ack}) when Action == ack -> + array:set(RelSeq, {Pub, Del, ack}, JEntries) + end. maybe_flush_journal(State = #qistate { dirty_count = DCount, max_journal_entries = MaxJournal }) |
