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

Store entire ring under single key in Consul. #24

Merged
merged 6 commits into from Sep 7, 2016
Merged

Conversation

tomwilkie
Copy link
Owner

@tomwilkie tomwilkie commented Sep 7, 2016

  • Handles token collision
  • More graceful handling of ingesters going away
  • Should handle consul going away for both ingesters and distributors
  • Adds ingester heartbeating

Part of #8

Get(key string, factory InstanceFactory) error
CAS(key string, factory InstanceFactory, f CASCallback) error
WatchPrefix(path string, factory InstanceFactory, done chan struct{}, f func(string, interface{}) bool)
WatchKey(key string, factory InstanceFactory, done chan struct{}, f func(interface{}) bool)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update the doc comment with a note about InstanceFactory.

populateRingDesc(ringDesc, r.id, r.hostname, tokens)

return ringDesc, true, nil
}); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This took me quite a while to figure out. Here are some things that I think might help make it easier to follow:

  • Separate assigning to err from the err != nil check
  • Define the function being passed to CAS separately and give it a name. Make tokens a parameter of that function and close over tokens here.

@jml
Copy link
Collaborator

jml commented Sep 7, 2016

Done my first pass review. I'll wait until you give me a heads up before doing a second pass.

Looks really good though!

maxBackoff = 1 * time.Minute
)
var (
backoff = initialBackoff / 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be / 2

@jml
Copy link
Collaborator

jml commented Sep 7, 2016

What's your testing strategy for this?

@jml
Copy link
Collaborator

jml commented Sep 7, 2016

A few more questions. I promise the final round of review will be very quick.

@tomwilkie
Copy link
Owner Author

What's your testing strategy for this?

I've run this all locally and tested killing all the various components in various orders.

@jml
Copy link
Collaborator

jml commented Sep 7, 2016

LGTM, thanks.

In a future PR, we should automate those tests you did.

@tomwilkie tomwilkie merged commit 0eb8da0 into master Sep 7, 2016
@tomwilkie tomwilkie deleted the better-ring branch September 7, 2016 16:12
@jml jml mentioned this pull request Sep 9, 2016
4 tasks
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