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 | ae85eea0d4272b8264b8be92300ba8271a2b9ef4 (patch) | |
| tree | c10827469b5e1e1a0c5acff5d17034b220732386 | |
| parent | 0de9980c125ff0b24099c71b94d03bbebfefc301 (diff) | |
| parent | b0971d13a8836b6cafcb2c63e8bb5db8cd510a6e (diff) | |
| download | rabbitmq-server-git-ae85eea0d4272b8264b8be92300ba8271a2b9ef4.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 7a3c17a29c..8998c0e860 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). |
