summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Harrop <rob@rabbitmq.com>2011-05-19 13:39:37 +0100
committerRob Harrop <rob@rabbitmq.com>2011-05-19 13:39:37 +0100
commitb8913674b655379f446a8bb80114b711e1174971 (patch)
tree33f748fa89b632a9881d154006d29bec96fa8382
parent809585e9e7d1f5640e96622d618b1f7bb5b3d1dd (diff)
parentdd284ed329fe2a0888d5a0df23fd7c5fcff8ba85 (diff)
downloadrabbitmq-server-b8913674b655379f446a8bb80114b711e1174971.tar.gz
Merge bug24116 into default
-rw-r--r--src/rabbit_variable_queue.erl25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 7a3c17a2..8998c0e8 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -565,19 +565,28 @@ dropwhile(Pred, State) ->
dropwhile1(Pred, State) ->
internal_queue_out(
- fun(MsgStatus = #msg_status { msg_props = MsgProps }, State1) ->
+ fun(MsgStatus = #msg_status { msg_props = MsgProps, msg = Msg,
+ index_on_disk = IndexOnDisk },
+ State1 = #vqstate { q3 = Q3, q4 = Q4,
+ ram_index_count = RamIndexCount }) ->
case Pred(MsgProps) of
true ->
{_, State2} = internal_fetch(false, MsgStatus, State1),
dropwhile1(Pred, State2);
false ->
- %% message needs to go back into Q4 (or maybe go
- %% in for the first time if it was loaded from
- %% Q3). Also the msg contents might not be in
- %% RAM, so read them in now
- {MsgStatus1, State2 = #vqstate { q4 = Q4 }} =
- read_msg(MsgStatus, State1),
- {ok, State2 #vqstate {q4 = queue:in_r(MsgStatus1, Q4) }}
+ {ok,
+ case Msg of
+ undefined ->
+ true = queue:is_empty(Q4), %% ASSERTION
+ Q3a = bpqueue:in_r(IndexOnDisk, MsgStatus, Q3),
+ RamIndexCount1 =
+ RamIndexCount + one_if(not IndexOnDisk),
+ State1 #vqstate {
+ q3 = Q3a, ram_index_count = RamIndexCount1 };
+ _ ->
+ Q4a = queue:in_r(MsgStatus, Q4),
+ State1 #vqstate { q4 = Q4a }
+ end}
end
end, State).