Skip to content

Start mirrors synchronously when transferring CMQ leadership #2751

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 4 commits into from
Jan 27, 2021

Conversation

michaelklishin
Copy link
Collaborator

@michaelklishin michaelklishin commented Jan 26, 2021

Proposed Changes

This changes classic mirror queue leadership transfer to add mirrors synchronously and also delete
fewer mirrors where it's not warranted.

We also used this as an opportunity to rename a few things around the relevant code paths.

Closes #2749.
References #2737.

Types of Changes

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

Pairs: @dcorbacho @mkuratczyk.

of classic mirrored queues.

There are cases when asynchronously adding mirrors makes
a lot of sense: e.g. when a new node joins the cluster.
In this case, if we add mirrors asynchronously, this
operation will race with the step that removes mirrors.
As a result, we can end up with a queue that decided
that it had no promotable replicas => data loss
from the transfer.

Closes #2749.

Pairs: @dcorbacho, @mkuratczyk
Since we only consider nodes hosting
in-sync replicas for transfer candidates,
we can drop only one mirror instead of N,
and reduce the load caused by this operation.

This does not affect CMQ leadership
transfer when performed in the context
'rabbitmq-queues rebalance'

Pair: @dcorbacho, @mkuratczyk
@michaelklishin michaelklishin changed the title Rabbitmq server 2749 Start mirrors synchronously when transferring CMQ leadership (when a node is put under maintenance) Jan 26, 2021
@michaelklishin michaelklishin changed the title Start mirrors synchronously when transferring CMQ leadership (when a node is put under maintenance) Start mirrors synchronously when transferring CMQ leadership Jan 26, 2021
not only it uses unfortunate terms to refer to secondaries,
it is not particularly clear.
@michaelklishin
Copy link
Collaborator Author

We are considering exclude CMQ leadership transfer from maintenance mode because it can take quite some time in clusters with a lot of queue, and this cannot really be optimized. Quorum queues transfer leadership a lot more efficiently, so that can stay. However, this change can be merged as is.

@michaelklishin michaelklishin merged commit 50761cb into master Jan 27, 2021
@michaelklishin michaelklishin deleted the rabbitmq-server-2749 branch January 27, 2021 00:02
QPid = amqqueue:get_pid(Q),
SPids = amqqueue:get_slave_pids(Q),
case [Pid || Pid <- [QPid | SPids], node(Pid) =:= MirrorNode] of
PrimaryPid = amqqueue:get_pid(Q),

Choose a reason for hiding this comment

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

John O'Hara - inventor of AMQP - will be sad to see the demise of QPid - AMQP's first implementation - from the RabbitMQ codebase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hahaha. Definitely a good one 🤓

michaelklishin added a commit that referenced this pull request Jan 27, 2021
Start mirrors synchronously when transferring CMQ leadership

(cherry picked from commit 50761cb)
mkuratczyk added a commit to rabbitmq/rabbitmq-website that referenced this pull request Jan 28, 2021
Starting with 3.8.12, `rabbitmq-upgrade` drain will not transfer classic mirrored queue leaders.
See rabbitmq/rabbitmq-server#2751 for more info
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.

Classic mirrored queue leadership transfer eagerly clears the list of mirrors which can result in data loss
2 participants