Skip to content

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

Merged
merged 7 commits into from
May 15, 2018
Merged

Hard cap for maximum priorities #1597

merged 7 commits into from
May 15, 2018

Conversation

michaelklishin
Copy link
Collaborator

@michaelklishin michaelklishin commented May 12, 2018

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

  • Bug fix (non-breaking change which fixes issue Hard cap for max queue priorities #1590)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

Closes #1590.

This is the value we advertise in the docs
and it should be enforced to avoid process explosion
e.g. when an overflow value is provided.

Part of #1590.

[#157380396]
@michaelklishin michaelklishin changed the title DO NOT MERGE Hard cap for maximum priorities Hard cap for maximum priorities May 14, 2018
@acogoluegnes acogoluegnes self-requested a review May 14, 2018 08:13
@acogoluegnes acogoluegnes self-assigned this May 14, 2018
@michaelklishin
Copy link
Collaborator Author

michaelklishin commented May 14, 2018

How to QA priority definition via policies (a drive-by change in this feature):

  • Set up a policy
  • Declare a matching queue
  • Publish 200 messages with random priorities (I used 1 through 5)
  • Add a consumer that prints message priority and observe that they are consumed in priority order

Java client test PR focuses on the limits and should be self-explanatory.

@@ -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;
Copy link
Contributor

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?

@@ -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 ->
Copy link
Contributor

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?

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]};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@michaelklishin michaelklishin changed the title Hard cap for maximum priorities DO NOT MERGE Hard cap for maximum priorities May 14, 2018
@michaelklishin
Copy link
Collaborator Author

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]
@michaelklishin michaelklishin changed the title DO NOT MERGE Hard cap for maximum priorities Hard cap for maximum priorities May 14, 2018
@acogoluegnes acogoluegnes merged commit 92261a4 into master May 15, 2018
@lukebakken lukebakken deleted the rabbitmq-server-1590 branch December 21, 2018 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hard cap for max queue priorities
2 participants