balancer: add StateListener to NewSubConnOptions for SubConn state updates#6481
balancer: add StateListener to NewSubConnOptions for SubConn state updates#6481dfawley merged 5 commits intogrpc:masterfrom
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.
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.
Yes, from tests... Loads of tests call these methods. I cleaned up some, but there are more.
There was a problem hiding this comment.
Do we have a TODO or an issue to track that?
There was a problem hiding this comment.
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.goandweightedtarget_test.go, which now calls theSubConns directly to update their state. Future PRs will migrate all our balancers to use this functionality.#6472
RELEASE NOTES:
StateListenertoNewSubConnOptionsforSubConnstate updates and deprecateBalancer.UpdateSubConnState--- NOTICE: TheBalancer.UpdateSubConnStatemethod will be deleted in a future release andNewSubConnOptions.StateListenerwill be required.