grpc / grpc-java

The Java gRPC implementation. HTTP/2 based RPC
https://grpc.io/docs/languages/java/
Apache License 2.0
11.48k stars 3.85k forks source link

util: Remove EAG conveniences from MultiChildLb #11682

Closed ejona86 closed 1 week ago

ejona86 commented 1 week ago

This is a step toward removing ResolvedAddresses from ChildLbState, which isn't actually used by MultiChildLb. Most usages of the EAG usages can be served more directly without peering into MultiChildLb's internals or even accessing ChildLbStates, which make the tests less sensitive to implementation changes. Some changes do leverage the new behavior of MultiChildLb where it preserves the order of the entries.

This does fix an important bug in shutdown tests. The tests looped over the ChildLbStates after shutdown, but shutdown deleted all the children so it looped over an entry collection. Fixing that exposed that deliverSubchannelState() didn't function after shutdown, as the listener was removed from the map when the subchannel was shut down. Moving the listener onto the TestSubchannel allowed having access to the listener even after shutdown.

A few places in LeastRequestLb lines were just deleted, but that's because an existing assertion already provided the same check but without digging into MultiChildLb.