Skip to content

[client channel] move health checking code out of subchannel and into LB policies#32709

Merged
markdroth merged 19 commits into
grpc:masterfrom
markdroth:health_check_client_data_watcher_new
Apr 20, 2023
Merged

[client channel] move health checking code out of subchannel and into LB policies#32709
markdroth merged 19 commits into
grpc:masterfrom
markdroth:health_check_client_data_watcher_new

Conversation

@markdroth

@markdroth markdroth commented Mar 24, 2023

Copy link
Copy Markdown
Member

This paves the way for making pick_first the universal leaf policy (see #32692), which will be needed for the dualstack design. That change will require changing pick_first to see both the raw connectivity state and the health-checking connectivity state of a subchannel, so that we can enable health checking when pick_first is used underneath round_robin without actually changing the pick_first connectivity logic (currently, pick_first always disables health checking). To make it possible to do that, this PR moves the health checking code out of the subchannel and into a separate API using the same data-watcher mechanism that was added for ORCA OOB calls.

@markdroth markdroth changed the title WIP: move health check client out of subchannel [health checking] move health checking code out of subchannel and into LB policies Apr 18, 2023
@markdroth markdroth marked this pull request as ready for review April 19, 2023 17:22
@markdroth markdroth requested a review from eugeneo April 19, 2023 17:22
void set_attempting_index(size_t index) { attempting_index_ = index; }

private:
std::shared_ptr<WorkSerializer> work_serializer() const override {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved to a base class?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it can't. The problem is that LoadBalancingPolicy::work_serializer() is protected, so it can be accessed only in subclasses. And the base SubchannelList class is not nested inside of a subclass of LoadBalancingPolicy, but the individual subclasses of SubchannelList are nested inside of subclasses of LoadBalancingPolicy, so this is where it needs to be.

I agree that this is ugly. However, I plan to clean this up as part of the changes I'm going to be making for the dualstack design. Once I make pick_first the universal leaf policy, it will be the only policy actually using SubchannelList, and at that point I will move the code directly into pick_first so that it no longer needs to be a separate base class.

@markdroth markdroth changed the title [health checking] move health checking code out of subchannel and into LB policies [client channel] move health checking code out of subchannel and into LB policies Apr 20, 2023
@markdroth markdroth merged commit 0c08ed7 into grpc:master Apr 20, 2023
@markdroth markdroth deleted the health_check_client_data_watcher_new branch April 20, 2023 22:18
@copybara-service copybara-service Bot added the imported Specifies if the PR has been imported to the internal repository label Apr 20, 2023
XuanWang-Amos pushed a commit to XuanWang-Amos/grpc that referenced this pull request May 1, 2023
… LB policies (grpc#32709)

This paves the way for making pick_first the universal leaf policy (see
grpc#32692), which will be needed for the dualstack design. That change will
require changing pick_first to see both the raw connectivity state and
the health-checking connectivity state of a subchannel, so that we can
enable health checking when pick_first is used underneath round_robin
without actually changing the pick_first connectivity logic (currently,
pick_first always disables health checking). To make it possible to do
that, this PR moves the health checking code out of the subchannel and
into a separate API using the same data-watcher mechanism that was added
for ORCA OOB calls.
wanlin31 pushed a commit that referenced this pull request May 18, 2023
… LB policies (#32709)

This paves the way for making pick_first the universal leaf policy (see
#32692), which will be needed for the dualstack design. That change will
require changing pick_first to see both the raw connectivity state and
the health-checking connectivity state of a subchannel, so that we can
enable health checking when pick_first is used underneath round_robin
without actually changing the pick_first connectivity logic (currently,
pick_first always disables health checking). To make it possible to do
that, this PR moves the health checking code out of the subchannel and
into a separate API using the same data-watcher mechanism that was added
for ORCA OOB calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bloat/low imported Specifies if the PR has been imported to the internal repository lang/core lang/Python per-call-memory/neutral per-channel-memory/neutral release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants