Skip to content
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

Correct consistent hashing exchange binding deletion when there are duplicate bindings #3594

Merged
merged 2 commits into from
Oct 19, 2021
Merged

Correct consistent hashing exchange binding deletion when there are duplicate bindings #3594

merged 2 commits into from
Oct 19, 2021

Conversation

FalconerTC
Copy link

@FalconerTC FalconerTC commented Oct 19, 2021

Proposed Changes

The x-consistent-hash plugin has unexpected behavior when multiple bindings are established to the same queue (see #3386). This causes the hash ring to enter an invalid state, where messages can not be consistently routed anywhere. When entering this state, the only resolution is to delete and recreate the exchange. To replicate:

  1. Create an x-consistent-hash exchange
  2. Create a binding to a queue Q1
  3. Create a second binding of different weight to queue Q1
  4. Delete either binding, or delete Q1

This PR hopes to resolve the Bucket 0 not found errors that occur when the hash ring enters an invalid state. When removing a binding, it adjusts queues based on the buckets being removed rather than the weight specified, which differ only with duplicate bindings.

This is possibly also related to #3001

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Put an x in the boxes that apply.
You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

Further Comments

I'm not familiar with the project, nor with erlang, so open to any an all suggestions.

This does not fix the greater issue brought up in #3386, where nodes coming up and down result in multiple entries in the hash ring. Longer term, it may be better to disallow adding multiple bindings to a single queue. Given this issue with binding deletion, that feature has probably not been in use much.

@FalconerTC FalconerTC marked this pull request as ready for review October 19, 2021 19:28
@FalconerTC FalconerTC changed the title {consistent_hash} Fix duplicate binding exchange {consistent_hash} Fix issue deleting duplicate binding exchange Oct 19, 2021
@michaelklishin michaelklishin changed the title {consistent_hash} Fix issue deleting duplicate binding exchange Correct consistent hashing exchange binding deletion when there are duplicate bindings Oct 19, 2021
@michaelklishin
Copy link
Member

This exchange was never meant to be used with duplicate bindings, this is why it has routing key weights.

Handing duplicates is nice but there is a reason why this has gone largely unreported for years: this is not how this plugin is supposed to be used.

@michaelklishin michaelklishin merged commit 43b1061 into rabbitmq:master Oct 19, 2021
@michaelklishin
Copy link
Member

Thank you.

@michaelklishin
Copy link
Member

michaelklishin commented Oct 19, 2021

Backported to v3.9.x manually (for 3.9.9).

@michaelklishin
Copy link
Member

Backported to v3.8.x manually.

@michaelklishin michaelklishin added this to the 3.8.24 milestone Oct 19, 2021
@FalconerTC FalconerTC deleted the falconertc/fix_duplicate_binding_exchange branch November 16, 2021 22:06
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.

None yet

2 participants