summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-11-22 00:20:28 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-11-22 00:20:28 +0000
commit0565c4b1c518d55e6ece9c9bb03662bd54bfdef5 (patch)
tree8a3c3f0992ee6219b75f6ef542f5ac86431dfc79
parent8e321a49d9824af496dfc0689a57d21a0965d695 (diff)
downloadrabbitmq-server-bug25306.tar.gz
leave the ram_msg_count unchanged in BQ:foldbug25306
since we are not moving messages *into the queue*
-rw-r--r--src/rabbit_variable_queue.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index b96ce3cf..6dc65bab 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 {