-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Hard cap for maximum priorities #1597
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
Conversation
How to QA priority definition via policies (a drive-by change in this feature):
Java client test PR focuses on the limits and should be self-explanatory. |
src/rabbit_amqqueue.erl
Outdated
@@ -611,6 +611,13 @@ check_message_ttl_arg({Type, Val}, Args) -> | |||
Error -> Error | |||
end. | |||
|
|||
check_max_priority_arg({Type, Val}, Args) -> | |||
case check_non_neg_int_arg({Type, Val}, Args) of | |||
ok when Val =< 255 -> ok; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for not using the MAX_SUPPORTED_PRIORITY
constant here?
src/rabbit_policies.erl
Outdated
@@ -100,6 +101,12 @@ validate_policy0(<<"max-length-bytes">>, Value) | |||
validate_policy0(<<"max-length-bytes">>, Value) -> | |||
{error, "~p is not a valid maximum length in bytes", [Value]}; | |||
|
|||
validate_policy0(<<"max-priority">>, Value) | |||
when is_integer(Value), Value >= 0, Value =< 255 -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previously, any reason for not using the MAX_SUPPORTED_PRIORITY
constant here?
src/rabbit_policies.erl
Outdated
when is_integer(Value), Value >= 0, Value =< 255 -> | ||
ok; | ||
validate_policy0(<<"max-priority">>, Value) -> | ||
{error, "~p is not a valid max priority (must be an integer in the 1-255 range)", [Value]}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
We found out why policies were not supported earlier: they can change while certain message store aspects of priority queues are not (must be fixed). So I will undo some portions of this PR and docs. |
This reverts commit f5aa1fb. This feature wasn't available in the original implementation for a reason: policies are dynamic and can change after a queue's been declared. However, queue priorities are (at least currently) set in stone from the moment of queue creation. This was mentioned in the docs but not explicitly enough and got overlooked. Credit for the [re-]discovery goes to @acogoluegnes :) References #1590. [#157380396]
References #1590. [#157380396]
Proposed Changes
This [re]introduces a hard cap on the maximum number of priorities supported by priority queues. See #1590 for details.
It also makes it possible to define priorities using a policy.
Types of Changes
Checklist
CONTRIBUTING.md
documentFurther Comments
Closes #1590.