-
Notifications
You must be signed in to change notification settings - Fork 816
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
[membership] Replace Ringop with PeerProvider interface #4653
[membership] Replace Ringop with PeerProvider interface #4653
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still reading, but sending partial notes anyway
} | ||
|
||
func (r *ringpopHashring) compareMembers(addrs []string) (map[string]struct{}, bool) { | ||
func (r *ring) compareMembers(addrs []string) (map[string]struct{}, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compareMembersLocked
too, as membersMap
needs to be protected by the lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit fuzzy on if duplicates are bad or just unexpected in all this tbh. one place checks, one doesn't, and I'm not sure what two subscribers in either location would imply behaviorally - naively it seems like it'd be fine, though it could be a sign of a double-start or something.
dac754c
to
93a1d83
Compare
93a1d83
to
ac9ea4e
Compare
common/membership/hashring.go
Outdated
r.logger.Error("Failed to send event to subscriber, channel full", tag.Subscriber(name)) | ||
} | ||
func (r *ring) refreshWithBackoff() error { | ||
if r.members.refreshed.After(time.Now().Add(-minRefreshInternal)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
side-benefit of that lock-in-struct pattern: easier to notice incorrect locking!
this needs to be locked or it'll be a racy read. which also brings up a general complication: if you get e.g. 5 calls at once, they can all pass this check and refresh 5x. probably worth fixing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed "with backoff" method, now there's only refreshWithLock()
select { | ||
case ch <- change: | ||
default: | ||
r.logger.Error("Failed to send listener notification, channel full", tag.Subscriber(name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really an error? or is it expected to be so rare that it may be a sign of problems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locking issues need to be fixed, but the rest are probably "whatever you agree with is fine", it's mostly minor stuff. Looks good overall :)
So I'll approve to unblock whenever you're ready, but feel free to re-request review if you want me to check the changes.
r.smu.RLock() | ||
defer r.smu.RUnlock() | ||
|
||
for name, ch := range r.subscribers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mantas-sidlauskas I was looking at why we never see Ring membership changed log and looks like after this refactoring we stopped notifying the subscribers. Was this intentional or missed?
What changed?
Membership resolver can be started with any
PeerProvider
implementation now.This means:
membership.Resolver
is not tightly coupled withRingpop
anymorePeerProvider
interface.HostInfo
. Labels are moved to part ofringpop
version ofPeerProvider
Why?
This change allows to implement different type of peer provider easily.
How did you test it?
Unit tests, local test
Potential risks
Release notes
Documentation Changes