diff options
author | Michael Klishin <mklishin@pivotal.io> | 2020-02-25 18:51:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 18:51:39 +0300 |
commit | 1cc662cf0d02d34f6f7b71b046f3859b47464e2a (patch) | |
tree | 13e0e46214bf77d3a1157048bea35565210bafa3 /src | |
parent | e1795a4ece425dc8ff840ae579a081289ef391fe (diff) | |
parent | ac86a6cad73cbcee0e94e65f245c5b89fffb220b (diff) | |
download | rabbitmq-server-git-1cc662cf0d02d34f6f7b71b046f3859b47464e2a.tar.gz |
Merge pull request #2256 from rabbitmq/rabbit-fifo-dead-letter-bug
Fix QQ crash recovery bug
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_fifo.erl | 13 | ||||
-rw-r--r-- | src/rabbit_fifo.hrl | 6 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/rabbit_fifo.erl b/src/rabbit_fifo.erl index 0917836b6a..251b370caa 100644 --- a/src/rabbit_fifo.erl +++ b/src/rabbit_fifo.erl @@ -146,7 +146,9 @@ update_config(Conf, State) -> SHICur = case State#?MODULE.cfg of #cfg{release_cursor_interval = {_, C}} -> C; - #cfg{release_cursor_interval = C} -> + #cfg{release_cursor_interval = undefined} -> + SHI; + #cfg{release_cursor_interval = C} -> C end, @@ -1086,8 +1088,9 @@ snd(T) -> return(Meta, ConsumerId, Returned, Effects0, #?MODULE{service_queue = SQ0} = State0) -> {State1, Effects1} = maps:fold( - fun(MsgId, {Tag, _} = Msg, {S0, E0}) when Tag == '$prefix_msg'; - Tag == '$empty_msg'-> + fun(MsgId, {Tag, _} = Msg, {S0, E0}) + when Tag == '$prefix_msg'; + Tag == '$empty_msg'-> return_one(MsgId, 0, Msg, S0, E0, ConsumerId); (MsgId, {MsgNum, Msg}, {S0, E0}) -> return_one(MsgId, MsgNum, Msg, S0, E0, @@ -1158,7 +1161,9 @@ dead_letter_effects(Reason, Discarded, #?MODULE{cfg = #cfg{dead_letter_handler = {Mod, Fun, Args}}}, Effects) -> DeadLetters = maps:fold(fun(_, {_, {_, {_Header, Msg}}}, Acc) -> - [{Reason, Msg} | Acc] + [{Reason, Msg} | Acc]; + (_, _, Acc) -> + Acc end, [], Discarded), [{mod_call, Mod, Fun, Args ++ [DeadLetters]} | Effects]. diff --git a/src/rabbit_fifo.hrl b/src/rabbit_fifo.hrl index 16e665f9df..2fae8c10ca 100644 --- a/src/rabbit_fifo.hrl +++ b/src/rabbit_fifo.hrl @@ -104,9 +104,9 @@ -record(cfg, {name :: atom(), resource :: rabbit_types:r('queue'), - release_cursor_interval = - {?RELEASE_CURSOR_EVERY, ?RELEASE_CURSOR_EVERY} :: - non_neg_integer() | {non_neg_integer(), non_neg_integer()}, + release_cursor_interval :: + undefined | non_neg_integer() | + {non_neg_integer(), non_neg_integer()}, dead_letter_handler :: option(applied_mfa()), become_leader_handler :: option(applied_mfa()), max_length :: option(non_neg_integer()), |