diff options
| author | Diana Corbacho <diana.corbacho@erlang-solutions.com> | 2016-06-14 07:40:04 +0100 |
|---|---|---|
| committer | Diana Corbacho <diana.corbacho@erlang-solutions.com> | 2016-06-14 07:40:04 +0100 |
| commit | b5ad8e6725a810b0065b3135c5f6b6e0b769d211 (patch) | |
| tree | ddbdc584f4fc034ff65a58e4c6127173259c6362 | |
| parent | 03d015c3bd2c86dc6df8413b58e2d780c783af08 (diff) | |
| download | rabbitmq-server-git-b5ad8e6725a810b0065b3135c5f6b6e0b769d211.tar.gz | |
Restore original order in batch publish messages
* During the synchronisation of slaves the message's order was
reverted. Then, acks could not be processed as those msgs
were not yet dropped.
| -rw-r--r-- | src/rabbit_priority_queue.erl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/rabbit_priority_queue.erl b/src/rabbit_priority_queue.erl index a3bfb5cdfa..ae8a38daf0 100644 --- a/src/rabbit_priority_queue.erl +++ b/src/rabbit_priority_queue.erl @@ -591,10 +591,15 @@ partition_publish_delivered_batch(Publishes, MaxP) -> Publishes, fun ({Msg, _}) -> Msg end, MaxP). partition_publishes(Publishes, ExtractMsg, MaxP) -> - lists:foldl(fun (Pub, Dict) -> - Msg = ExtractMsg(Pub), - rabbit_misc:orddict_cons(priority(Msg, MaxP), Pub, Dict) - end, orddict:new(), Publishes). + Partitioned = + lists:foldl(fun (Pub, Dict) -> + Msg = ExtractMsg(Pub), + rabbit_misc:orddict_cons(priority(Msg, MaxP), Pub, Dict) + end, orddict:new(), Publishes), + orddict:map(fun (_P, RevPubs) -> + lists:reverse(RevPubs) + end, Partitioned). + priority_bq(Priority, [{MaxP, _} | _] = BQSs) -> bq_fetch(priority(Priority, MaxP), BQSs). |
