diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-05-19 14:05:13 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-05-19 14:05:13 +0100 |
commit | f73b1f12810e85c81ad1693b005f6b51722c807d (patch) | |
tree | c10827469b5e1e1a0c5acff5d17034b220732386 | |
parent | 76bf983a059a1f431be1452896baed32b8eef4bf (diff) | |
parent | b8913674b655379f446a8bb80114b711e1174971 (diff) | |
download | rabbitmq-server-f73b1f12810e85c81ad1693b005f6b51722c807d.tar.gz |
Merging default to bug23554
-rw-r--r-- | src/rabbit_variable_queue.erl | 25 |
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). |