diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-05-18 12:42:47 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-05-18 12:42:47 +0100 |
commit | 6d9e82abd7b035a6e43dfd8ee7dc8d7289843b60 (patch) | |
tree | 858bd69da7564597928b4c54eae91c9929266ee4 | |
parent | 809585e9e7d1f5640e96622d618b1f7bb5b3d1dd (diff) | |
download | rabbitmq-server-6d9e82abd7b035a6e43dfd8ee7dc8d7289843b60.tar.gz |
Do not read the msg surviving dropwhile1
-rw-r--r-- | src/rabbit_variable_queue.erl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index 7a3c17a2..d5533e42 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -565,19 +565,23 @@ 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 }) -> 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) }} + case Msg of + undefined -> + true = queue:is_empty(Q4), %% ASSERTION + Q3a = bpqueue:in_r(IndexOnDisk, MsgStatus, Q3), + {ok, State1 #vqstate { q3 = Q3a }}; + _ -> + Q4a = queue:in_r(MsgStatus, Q4), + {ok, State1 #vqstate { q4 = Q4a }} + end end end, State). |