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

Add a retry block when hosts are added to replset #436

Merged
merged 3 commits into from
Jan 5, 2018

Conversation

pkilambi
Copy link
Contributor

@pkilambi pkilambi commented Jan 5, 2018

There is a race condition here where, if the master has changed since
the replset host add will fail. This can happen when scaling out of nodes
or when master is being migrated.

Adding a retry block here will give the hosts a chance to join the
cluster while the master is coming up.

There is a race condition here where, if the master has changed since
the replset host add will fail. This happens during scale out of nodes
or when master is being migrated.

Adding a retry block here will give the hosts a chance to join the
cluster while the master is coming up.
output = {}
output = rs_arbiter == host ? rs_add_arbiter(host, master) : rs_add(host, master)
retry_limit.times do |n|
begin
Copy link
Contributor

Choose a reason for hiding this comment

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

We can drop lines 246, 257 (new begin-end scope block is implied by the times do |n| loop)

Puppet.debug "Retry adding host to replicaset. Retry: #{n}"
sleep retry_sleep
master = master_host(alive_hosts)
next
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can drop the next too, as it doesn't skip anything and the loop will progress to the next iteration by itself.

@bastelfreak bastelfreak added the bug Something isn't working label Jan 5, 2018
@bastelfreak
Copy link
Member

Thanks for the PR @pkilambi and thanks for review @jistr !

@bastelfreak bastelfreak merged commit 951b8a2 into voxpupuli:master Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants