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 | ff11ce2755d725c3d798abd0a3e544f803a345e0 (patch) | |
| tree | 858bd69da7564597928b4c54eae91c9929266ee4 /src | |
| parent | 3870c1b3ddaf6f147da33d98942a497ad60a8253 (diff) | |
| download | rabbitmq-server-git-ff11ce2755d725c3d798abd0a3e544f803a345e0.tar.gz | |
Do not read the msg surviving dropwhile1
Diffstat (limited to 'src')
| -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 7a3c17a29c..d5533e4222 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). |
