Skip to content

Check exclusive owner before durable argument #1888

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 3 commits into from
Feb 18, 2019
Merged
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
18 changes: 10 additions & 8 deletions src/rabbit_amqqueue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,14 @@ priv_absent(QueueName, _QPid, _IsDurable, timeout) ->
rabbit_framing:amqp_table(), rabbit_types:maybe(pid())) ->
'ok' | rabbit_types:channel_exit() | rabbit_types:connection_exit().

assert_equivalence(Q, Durable1, AD1, Args1, Owner) ->
assert_equivalence(Q, DurableDeclare, AutoDeleteDeclare, Args1, Owner) ->
QName = amqqueue:get_name(Q),
Durable = amqqueue:is_durable(Q),
AD = amqqueue:is_auto_delete(Q),
rabbit_misc:assert_field_equivalence(Durable, Durable1, QName, durable),
rabbit_misc:assert_field_equivalence(AD, AD1, QName, auto_delete),
assert_args_equivalence(Q, Args1),
check_exclusive_access(Q, Owner, strict).
DurableQ = amqqueue:is_durable(Q),
AutoDeleteQ = amqqueue:is_auto_delete(Q),
ok = check_exclusive_access(Q, Owner, strict),
ok = rabbit_misc:assert_field_equivalence(DurableQ, DurableDeclare, QName, durable),
ok = rabbit_misc:assert_field_equivalence(AutoDeleteQ, AutoDeleteDeclare, QName, auto_delete),
ok = assert_args_equivalence(Q, Args1).

-spec check_exclusive_access(amqqueue:amqqueue(), pid()) ->
'ok' | rabbit_types:channel_exit().
Expand All @@ -640,7 +640,9 @@ check_exclusive_access(Q, _ReaderPid, _MatchType) ->
QueueName = amqqueue:get_name(Q),
rabbit_misc:protocol_error(
resource_locked,
"cannot obtain exclusive access to locked ~s",
"cannot obtain exclusive access to locked ~s. It could be originally "
"declared on another connection or the exclusive property value does not "
"match that of the original declaration.",
[rabbit_misc:rs(QueueName)]).

-spec with_exclusive_access_or_die(name(), pid(), qfun(A)) ->
Expand Down