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

Added PeerManagement.Type = 'etcd' #506

Closed
wants to merge 2 commits into from

Conversation

Baliedge
Copy link
Contributor

@Baliedge Baliedge commented Sep 7, 2022

Which problem is this PR solving?

This PR offers an alternative to Redis for centralized peer discovery using an etcd service.

Short description of the changes

  • This PR builds on the changes in Added PeerManagement.Timeout config option #491
  • Added three new config options: xxx
  • Added Close(ctx context.Context) error to the Peers interface to allow for clean shutdown and de-registration of an instance from the cluster.

Race condition in Peers interface design

Since peer.NewPeers() launches async go routines for both Redis and etcd, it is possible that a callback could occur before we call RegisterUpdatedPeersCallback() to register the call back, therefore missing the initial callback.

For example, in etcd_test.go we should be able to assert that p0 will receive 3 callbacks, one for itself, and then 2 for each additional member. However, because of the race condition, we might only get 2 callbacks.

We could change the Peers interface to instead register a callback during peer.NewPeers(conf, cb) call OR we could add a Start() method to the Peers interface, such that users would RegisterUpdatedPeersCallback() and then call Start() when ready to participate in receiving updates.

@MikeGoldsmith MikeGoldsmith self-assigned this Sep 7, 2022
@MikeGoldsmith MikeGoldsmith added type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible. status: review needed Changes need review. status: oncall Flagged for awareness from Honeycomb Telemetry Oncall status: revision needed Waiting for response to changes requested. and removed status: review needed Changes need review. labels Sep 7, 2022
@MikeGoldsmith
Copy link
Contributor

Thanks for opening @Baliedge. Let us know when you're ready for review.

I like the idea of expanding the peers interface to have a Start() func that would remove the race condition you've identified.

@MikeGoldsmith MikeGoldsmith mentioned this pull request Sep 28, 2022
@github-actions
Copy link

Marking this PR as stale because it has been open 30 days with no activity. Please add a comment if this PR is still relevant; otherwise this PR will be automatically closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 13, 2022
@github-actions
Copy link

Closing this PR due to inactivity. Please see our Honeycomb OSS Lifecyle and Practices.

@github-actions github-actions bot closed this Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale status: oncall Flagged for awareness from Honeycomb Telemetry Oncall status: revision needed Waiting for response to changes requested. type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants