-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
balancer: add StateListener to NewSubConnOptions for SubConn state updates #6481
Conversation
// UpdateSubConnState forwards the update to the appropriate child. | ||
func (gsb *Balancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { | ||
gsb.updateSubConnState(sc, state, nil) |
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.
Since ccb
is switched to calling subConn.UpdateState
, when and how will this be ever called? From tests maybe (which need to be updated)?
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.
Yes, from tests... Loads of tests call these methods. I cleaned up some, but there are more.
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.
Do we have a TODO or an issue to track that?
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.
That will need to be done as part of #6472. Once this PR lands and I start migrating more things, I'll make UpdateSubConnState
for each balancer into a nop and stop calling it from tests at that time. I'll likely do every balancer in its own PR. In hindsight, I probably would have just left the tests I changed in this PR alone to keep the changes smaller, but it's also a nice preview into how it will look, so I left it.
See grpc/grpc-go#6481, specifically weightedtarget_test.go as an example of how tests need to be migrated now that UpdateSubConnState is deprecated. I have followed the same example in our dispatcher_test.go
See grpc/grpc-go#6481, specifically weightedtarget_test.go as an example of how tests need to be migrated now that UpdateSubConnState is deprecated. I have followed the same example in our dispatcher_test.go
See grpc/grpc-go#6481, specifically weightedtarget_test.go as an example of how tests need to be migrated now that UpdateSubConnState is deprecated. I have followed the same example in our dispatcher_test.go
See grpc/grpc-go#6481, specifically weightedtarget_test.go as an example of how tests need to be migrated now that UpdateSubConnState is deprecated. I have followed the same example in our dispatcher_test.go
See grpc/grpc-go#6481, specifically weightedtarget_test.go as an example of how tests need to be migrated now that UpdateSubConnState is deprecated. I have followed the same example in our dispatcher_test.go
See grpc/grpc-go#6481, specifically weightedtarget_test.go as an example of how tests need to be migrated now that UpdateSubConnState is deprecated. I have followed the same example in our dispatcher_test.go
This change is backward-compatible. However I've labeled it as "API Change" since we are deprecating
Balancer.UpdateSubConnState
.This also does not fully migrate all our code to stop using
UpdateSubConnState
. In particular, many tests still invoke this method, and will need to be migrated over slowly. However, it is the minimal amount of changes required to keep everything working while providing support for this optional feature throughout. It also shows an example of how the other tests can be updated for this transition ingracefulswitch_test.go
andweightedtarget_test.go
, which now calls theSubConn
s directly to update their state. Future PRs will migrate all our balancers to use this functionality.#6472
RELEASE NOTES:
StateListener
toNewSubConnOptions
forSubConn
state updates and deprecateBalancer.UpdateSubConnState
--- NOTICE: TheBalancer.UpdateSubConnState
method will be deleted in a future release andNewSubConnOptions.StateListener
will be required.