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

Upcoming experimental Balancer API changes #4207

Closed
easwars opened this issue Feb 17, 2021 · 6 comments
Closed

Upcoming experimental Balancer API changes #4207

easwars opened this issue Feb 17, 2021 · 6 comments
Assignees
Labels
P3 Type: API Change Breaking API changes (experimental APIs only!)

Comments

@easwars
Copy link
Contributor

easwars commented Feb 17, 2021

The balancer API uses important pieces of functionality provided by gRPC via the following interfaces: balancer.ClientConn and balancer.SubConn.

While the balancer.ClientConn interface provides the functionality to create and delete a balancer.SubConn, the functionality to modify the addresses of an existing balancer.SubConn is provided by the balancer.SubConn interface itself. This asymmetry create an unnecessary pain-point for LB policy implementations in a setup with a tree of LB policies.

The proposed API change here is as follows:

  • Extend the balancer.ClientConn interface by providing a way to update addresses of an existing balancer.SubConn.
	// UpdateAddresses updates the addresses used in the passed in SubConn.
	// gRPC checks if the currently connected address is still in the new list.
	// If so, the connection will be kept. Else, the connection will be
	// gracefully closed, and a new connection will be created.
	//
	// This will trigger a state transition for the SubConn.
	UpdateAddresses(SubConn, []resolver.Address)
  • Remove the UpdateAddresses method on the balancer.SubConn interface, which would then provide a single Connect() method.

The plan would be as follows:

  • Add UpdateAddresses() to balancer.ClientConn as part of the 1.37.x release.
  • Remove UpdateAddresses() from balancer.SubConn in a future release. Maybe 1.38.x or a subsequent one.
    • We will wait 2 release. So UpdateAddresses() will be removed in v1.39.x

While these changes are not strictly following semantic versioning or the Go compatibility promise, they are in accordance with our versioning policy as the changes are limited to experimental APIs.

@easwars easwars added Type: Feature New features or improvements in behavior Type: API Change Breaking API changes (experimental APIs only!) labels Feb 17, 2021
@easwars easwars added this to the 1.37 Release milestone Feb 17, 2021
@easwars
Copy link
Contributor Author

easwars commented Feb 17, 2021

@dfawley @menghanl

@UnderTreeTech
Copy link

UnderTreeTech commented Mar 12, 2021

still remember the pain of etcd. Hope this change would not cause another disaster.

@menghanl menghanl modified the milestones: 1.37 Release, 1.38 Release Mar 31, 2021
@dfawley dfawley removed this from the 1.38 Release milestone May 6, 2021
@dfawley dfawley removed the Type: Feature New features or improvements in behavior label Apr 5, 2022
@zasweq zasweq added P3 and removed P1 labels May 24, 2022
@dfawley
Copy link
Member

dfawley commented Sep 23, 2022

To align better with gRPC-Java's LB policy API, and to simplify the effort required to implement LB policies in a hierarchy, we will be making these changes in the opposite direction from what was originally proposed in this issue.

Namely:

  • Remove balancer.ClientConn.UpdateAddresses and un-deprecate balancer.SubConn.UpdateAddresses as its replacement
  • Remove balancer.ClientConn.RemoveSubConn and add balancer.SubConn.Shutdown as its replacement
  • Add balancer.SubConn.SetStateListener (exact name TBD) to enable subscribing to subconn state changes via callbacks

still remember the pain of etcd. Hope this change would not cause another disaster.

I hope so too. The package is and always has been clearly labeled as experimental, meaning no backward compatibility guarantees are promised, but big scary warnings apparently don't prevent library developers from using it anyway.

@patrickfreed
Copy link

Is there a projected timeline for when the balancer package will become stable? Or at least a subset of its API?

@dfawley
Copy link
Member

dfawley commented Nov 1, 2022

Unfortunately not. The Java API is also still experimental, and C++ still doesn't have a public API for this at all. We would want to do this all together so we can be sure we have a consistent set of features available (or at least possible) for our users. The changes we're proposing here will bring us more in line with Java, so that should help to make this happen sooner.

@dfawley
Copy link
Member

dfawley commented Jul 24, 2023

Replacing this notice with #6472 to encompass all the new things required by gRFC A61 as well.

@dfawley dfawley closed this as completed Jul 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 Type: API Change Breaking API changes (experimental APIs only!)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants