Skip to content

Conversation

murgatroid99
Copy link
Member

This includes a few related changes to the pick_first LB policy to simplify its behavior, in order to reduce the chances of reaching a bad state, and to make it easier to reason about:

  • In pickSubchannel, avoid assuming that the subchannel to be picked has any state related to this LB policy instance; in particular, don't assume that it has the state change listener registered, and don't have special case behavior if it's the same subchannel as the current pick. Instead, unconditionally reset the LB policy state and set up the relevant subchannel state from scratch.
  • In resetSubchannelList, remove the special case when handling the current pick.
  • In connectToAddressList, don't take any additional actions when immediately picking one of the new subchannels.
  • In removeCurrentPick, call unref last to completely avoid calling the connectivity state listener.
  • In updateAddressList, switch requestedResolutionSinceLastUpdate to false immediately instead of assuming that will be done elsewhere.

@murgatroid99
Copy link
Member Author

The last commit removes triedAllSubchannels and requestedResolutionSinceLastUpdate.

triedAllSubchannels just conditionally skips startNextSubchannelConnecting, but calling that an extra time shouldn't be a problem. It might just cause some extra connection attempts.

requestedResolutionSinceLastUpdate was used to request resolution exactly once each time every subchannel fails a connection attempt. Now instead the hasReportedTransientFailure is just reset each time it becomes true for every subchannel.

@murgatroid99 murgatroid99 merged commit a1b8972 into grpc:@grpc/[email protected] Sep 16, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants