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

Always notify subscribers on membership change #6283

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

dkrotx
Copy link
Contributor

@dkrotx dkrotx commented Sep 12, 2024

Currently there is an issue:

  • we loose lots of updates (a separate PR to address this)
  • we rely on periodic (every 10s) update to update membership
    regardless
  • but it doesn't notify subscribers

Because of that we were sometimes missing notifications in history and matching and didn't get any before the next rollout / restart.

What changed?
Subscribers of MultiringResolver were not notified if membership updated during periodic updates

Why?
Subscribers of MultiringResolver expect to be always notified on membership changes, and it doesn't really matter who triggered tag - membership update that we caught or periodic update which we do every 10s.

How did you test it?
This should just work this way, and it is been a mistake to decouple refresh/notify
Verified it on staging environments of Uber where we already see improvements during restart.

Potential risks
If some subscribers rely on event triggered the change, it can be unexpected to see an empty one (but not nil!).
At the same time, we're currently doing the same if Lookup wasn't able to find a host - we were implicitely pushing an empty changedEvent to signal the channel.
Currently existing subscriber does not rely, they simply ignore the event. In fact - it is a mistake to do the opposite: the event just triggered refresh(), but then even the refresh() builds a ring from scratch ignoring the event.

Release notes
Bugfix: Subscribers of MultiringResolver were not notified if membership updated during periodic updates

Currently there is an issue:
 - we loose lots of updates (a separate PR to address this)
 - we rely on periodic (every 10s) update to update membership
   regardless
 - but it doesn't notify subscribers

Because of that we were sometimes missing notifications in history and matching and didn't get any before the next rollout / restart.
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.11%. Comparing base (04add2d) to head (354faab).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
common/membership/hashring.go 80.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
common/membership/resolver.go 80.24% <100.00%> (ø)
common/membership/hashring.go 86.70% <80.00%> (+3.66%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04add2d...354faab. Read the comment docs.

Otherwise we would have to time.Sleep for 10s :-(
common/membership/hashring_test.go Outdated Show resolved Hide resolved
@dkrotx dkrotx enabled auto-merge (squash) September 12, 2024 19:11
@dkrotx dkrotx merged commit 34daef5 into master Sep 12, 2024
19 checks passed
@dkrotx dkrotx deleted the always-notify-subscribers branch September 12, 2024 19:45
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.

2 participants