diff options
| author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-04-24 14:34:56 +0100 |
|---|---|---|
| committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-04-24 14:34:56 +0100 |
| commit | ed96326921f6cd5bafc50b7c4ee4dbbcb0cc2e66 (patch) | |
| tree | d4ae97dce2adad0215ee5ed0ac150b4fcb240bc6 | |
| parent | b4667e30ddb575a111b8871e770963d00b6d910b (diff) | |
| download | rabbitmq-server-git-ed96326921f6cd5bafc50b7c4ee4dbbcb0cc2e66.tar.gz | |
Update the msg_id_ack in set_length.
| -rw-r--r-- | src/rabbit_mirror_queue_slave.erl | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index 2df5c82c06..e412fbbc5d 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -798,18 +798,22 @@ process_instruction({set_length, Length, AckRequired}, backing_queue_state = BQS }) -> QLen = BQ:len(BQS), ToDrop = QLen - Length, - {ok, case ToDrop >= 0 of - true -> BQS1 = - lists:foldl( - fun (const, BQSN) -> - {{_Msg, _IsDelivered, _AckTag, _Remaining}, - BQSN1} = BQ:fetch(AckRequired, BQSN), - BQSN1 - end, BQS, lists:duplicate(ToDrop, const)), - set_synchronised( - true, State #state { backing_queue_state = BQS1 }); - false -> State - end}; + {ok, + case ToDrop >= 0 of + true -> + State1 = + lists:foldl( + fun (const, StateN = #state {backing_queue_state = BQSN}) -> + {{#basic_message{id = MsgId}, _IsDelivered, AckTag, + _Remaining}, BQSN1} = BQ:fetch(AckRequired, BQSN), + maybe_store_ack( + AckRequired, MsgId, AckTag, + StateN #state { backing_queue_state = BQSN1 }) + end, State, lists:duplicate(ToDrop, const)), + set_synchronised(true, State1); + false -> + State + end}; process_instruction({fetch, AckRequired, MsgId, Remaining}, State = #state { backing_queue = BQ, backing_queue_state = BQS }) -> |
