diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2012-11-22 00:20:28 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-11-22 00:20:28 +0000 |
| commit | 8d15d6cbe7e640d7aa2d9d129b890f6f804a5d02 (patch) | |
| tree | 8a3c3f0992ee6219b75f6ef542f5ac86431dfc79 | |
| parent | 82aabb2b759fa58403f030a24bf8f6b9382e9c6a (diff) | |
| download | rabbitmq-server-git-8d15d6cbe7e640d7aa2d9d129b890f6f804a5d02.tar.gz | |
leave the ram_msg_count unchanged in BQ:fold
since we are not moving messages *into the queue*
| -rw-r--r-- | src/rabbit_variable_queue.erl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index b96ce3cf6d..6dc65bab31 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -643,7 +643,7 @@ fold(undefined, State, _AckTags) -> fold(MsgFun, State = #vqstate{pending_ack = PA}, AckTags) -> a(lists:foldl(fun(SeqId, State1) -> {MsgStatus, State2} = - read_msg(gb_trees:get(SeqId, PA), State1), + read_msg(gb_trees:get(SeqId, PA), false, State1), MsgFun(MsgStatus#msg_status.msg, SeqId), State2 end, State, AckTags)). @@ -1062,17 +1062,19 @@ queue_out(State = #vqstate { q4 = Q4 }) -> {{value, MsgStatus}, State #vqstate { q4 = Q4a }} end. +read_msg(MsgStatus, State) -> read_msg(MsgStatus, true, State). + read_msg(MsgStatus = #msg_status { msg = undefined, msg_id = MsgId, is_persistent = IsPersistent }, - State = #vqstate { ram_msg_count = RamMsgCount, - msg_store_clients = MSCState}) -> + CountDiskToRam, State = #vqstate { ram_msg_count = RamMsgCount, + msg_store_clients = MSCState}) -> {{ok, Msg = #basic_message {}}, MSCState1} = msg_store_read(MSCState, IsPersistent, MsgId), {MsgStatus #msg_status { msg = Msg }, - State #vqstate { ram_msg_count = RamMsgCount + 1, + State #vqstate { ram_msg_count = RamMsgCount + one_if(CountDiskToRam), msg_store_clients = MSCState1 }}; -read_msg(MsgStatus, State) -> +read_msg(MsgStatus, _CountDiskToRam, State) -> {MsgStatus, State}. internal_fetch(AckRequired, MsgStatus = #msg_status { |
