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

Sleep between cluster role reshuffling when sending tokens #26

Merged
merged 3 commits into from
Jan 4, 2023

Conversation

masnax
Copy link
Contributor

@masnax masnax commented Jan 4, 2023

On init, MicroCloud starts an mdns broadcast with all the join tokens for each service and peer as the text body. What this means is that all peers will attempt to join through that first initial member.

In some cases this can cause issues as a cluster rebalances roles as it grows. So this PR splits the broadcast in two. First we send out a broadcast with just 2 members, and wait for a few seconds before continuing with the rest.

…in first round

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
…bers join

To avoid issues when a new join request is being handled in the middle
of a role reshuffle, Sleep for a few seconds after creating a cluster of
size 3, before proceeding with the rest of the cluster members.

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
@stgraber stgraber merged commit d78a41a into canonical:main Jan 4, 2023
@tomponline
Copy link
Member

In some cases this can cause issues as a cluster rebalances roles as it grows.

What issues was this causing?

I ask because its my observation (from working on similar issues with the LXD test suite) that role re-balancing doesn't always occur within a set time limit, and thus adding a pause for a fixed time period may not fully solve the issue.

@masnax
Copy link
Contributor Author

masnax commented Jan 5, 2023

In some cases this can cause issues as a cluster rebalances roles as it grows.

What issues was this causing?

I ask because its my observation (from working on similar issues with the LXD test suite) that role re-balancing doesn't always occur within a set time limit, and thus adding a pause for a fixed time period may not fully solve the issue.

In this case, the error was a "dqlite leader not found" error on exactly one peer. The join request seems to be completely dropped because the join token gets used up too.

You're probably right that the sleep here is just a bandaid, but the error was pretty consistently reproducible with MicroCloud because every peer attempts to join at the almost exact same time.

I'm also not sure if it's exclusive to LXD's dqlite implementation, because I'm pretty sure the cluster got stuck joining MicroCeph too at one point.

@tomponline
Copy link
Member

I see thanks.

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

3 participants