Skip to content

Infinity loop in synchronisation of priority queues #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rabbit_mirror_queue_slave.erl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ handle_go(Q = #amqqueue{name = QName}) ->
Self, {rabbit_amqqueue, set_ram_duration_target, [Self]}),
{ok, BQ} = application:get_env(backing_queue_module),
Q1 = Q #amqqueue { pid = QPid },
ok = rabbit_queue_index:erase(QName), %% For crash recovery
_ = BQ:delete_crashed(Q), %% For crash recovery
BQS = bq_init(BQ, Q1, new),
State = #state { q = Q1,
gm = GM,
Expand Down
7 changes: 5 additions & 2 deletions src/rabbit_priority_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
info/2, invoke/3, is_duplicate/2, set_queue_mode/2,
zip_msgs_and_acks/4]).

-record(state, {bq, bqss}).
-record(state, {bq, bqss, max_priority}).
-record(passthrough, {bq, bqs}).

%% See 'note on suffixes' below
Expand Down Expand Up @@ -157,7 +157,8 @@ init(Q, Recover, AsyncCallback) ->
[{P, Init(P, Term)} || {P, Term} <- PsTerms]
end,
#state{bq = BQ,
bqss = BQSs}
bqss = BQSs,
max_priority = hd(Ps)}
end.
%% [0] collapse_recovery has the effect of making a list of recovery
%% terms in priority order, even for non priority queues. It's easier
Expand Down Expand Up @@ -419,6 +420,8 @@ info(Item, #passthrough{bq = BQ, bqs = BQS}) ->

invoke(Mod, {P, Fun}, State = #state{bq = BQ}) ->
pick1(fun (_P, BQSN) -> BQ:invoke(Mod, Fun, BQSN) end, P, State);
invoke(Mod, Fun, State = #state{bq = BQ, max_priority = P}) ->
pick1(fun (_P, BQSN) -> BQ:invoke(Mod, Fun, BQSN) end, P, State);
invoke(Mod, Fun, State = #passthrough{bq = BQ, bqs = BQS}) ->
?passthrough1(invoke(Mod, Fun, BQS)).

Expand Down
Loading