[WRR] delegate to pick_first as per dualstack design (#34245)

Rolls forward the changes from #33087, which were rolled back in #33718.

This change is now guarded by a disablable experiment.
pull/34232/head^2
Mark D. Roth 1 year ago committed by GitHub
parent a3b4c797a7
commit 25cb8e6ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      bazel/experiments.bzl
  2. 2
      src/core/BUILD
  3. 899
      src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc
  4. 18
      src/core/lib/experiments/experiments.cc
  5. 14
      src/core/lib/experiments/experiments.h
  6. 7
      src/core/lib/experiments/experiments.yaml
  7. 2
      src/core/lib/experiments/rollouts.yaml
  8. 4
      test/core/client_channel/lb_policy/weighted_round_robin_test.cc

@ -65,6 +65,7 @@ EXPERIMENTS = {
"cpp_lb_end2end_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
"flow_control_test": [
"lazier_stream_updates",
@ -72,10 +73,12 @@ EXPERIMENTS = {
"lb_unit_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
"xds_end2end_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
},
},
@ -127,6 +130,7 @@ EXPERIMENTS = {
"cpp_lb_end2end_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
"flow_control_test": [
"lazier_stream_updates",
@ -134,10 +138,12 @@ EXPERIMENTS = {
"lb_unit_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
"xds_end2end_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
},
},
@ -199,6 +205,7 @@ EXPERIMENTS = {
"cpp_lb_end2end_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
"flow_control_test": [
"lazier_stream_updates",
@ -206,10 +213,12 @@ EXPERIMENTS = {
"lb_unit_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
"xds_end2end_test": [
"client_channel_subchannel_wrapper_work_serializer_orphan",
"round_robin_delegate_to_pick_first",
"wrr_delegate_to_pick_first",
],
},
},

@ -4972,6 +4972,7 @@ grpc_cc_library(
"absl/status:statusor",
"absl/strings",
"absl/types:optional",
"absl/types:variant",
],
language = "c++",
deps = [
@ -4982,6 +4983,7 @@ grpc_cc_library(
"json",
"json_args",
"json_object_loader",
"lb_endpoint_list",
"lb_policy",
"lb_policy_factory",
"ref_counted",

@ -115,6 +115,10 @@ const char* const description_round_robin_delegate_to_pick_first =
"backend design.";
const char* const additional_constraints_round_robin_delegate_to_pick_first =
"{}";
const char* const description_wrr_delegate_to_pick_first =
"Change WRR code to delegate to pick_first as per dualstack backend "
"design.";
const char* const additional_constraints_wrr_delegate_to_pick_first = "{}";
const char* const
description_client_channel_subchannel_wrapper_work_serializer_orphan =
"Client channel subchannel wrapper hops into WorkSerializer at "
@ -180,6 +184,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"round_robin_delegate_to_pick_first",
description_round_robin_delegate_to_pick_first,
additional_constraints_round_robin_delegate_to_pick_first, true, true},
{"wrr_delegate_to_pick_first", description_wrr_delegate_to_pick_first,
additional_constraints_wrr_delegate_to_pick_first, true, true},
{"client_channel_subchannel_wrapper_work_serializer_orphan",
description_client_channel_subchannel_wrapper_work_serializer_orphan,
additional_constraints_client_channel_subchannel_wrapper_work_serializer_orphan,
@ -283,6 +289,10 @@ const char* const description_round_robin_delegate_to_pick_first =
"backend design.";
const char* const additional_constraints_round_robin_delegate_to_pick_first =
"{}";
const char* const description_wrr_delegate_to_pick_first =
"Change WRR code to delegate to pick_first as per dualstack backend "
"design.";
const char* const additional_constraints_wrr_delegate_to_pick_first = "{}";
const char* const
description_client_channel_subchannel_wrapper_work_serializer_orphan =
"Client channel subchannel wrapper hops into WorkSerializer at "
@ -348,6 +358,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"round_robin_delegate_to_pick_first",
description_round_robin_delegate_to_pick_first,
additional_constraints_round_robin_delegate_to_pick_first, true, true},
{"wrr_delegate_to_pick_first", description_wrr_delegate_to_pick_first,
additional_constraints_wrr_delegate_to_pick_first, true, true},
{"client_channel_subchannel_wrapper_work_serializer_orphan",
description_client_channel_subchannel_wrapper_work_serializer_orphan,
additional_constraints_client_channel_subchannel_wrapper_work_serializer_orphan,
@ -451,6 +463,10 @@ const char* const description_round_robin_delegate_to_pick_first =
"backend design.";
const char* const additional_constraints_round_robin_delegate_to_pick_first =
"{}";
const char* const description_wrr_delegate_to_pick_first =
"Change WRR code to delegate to pick_first as per dualstack backend "
"design.";
const char* const additional_constraints_wrr_delegate_to_pick_first = "{}";
const char* const
description_client_channel_subchannel_wrapper_work_serializer_orphan =
"Client channel subchannel wrapper hops into WorkSerializer at "
@ -516,6 +532,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"round_robin_delegate_to_pick_first",
description_round_robin_delegate_to_pick_first,
additional_constraints_round_robin_delegate_to_pick_first, true, true},
{"wrr_delegate_to_pick_first", description_wrr_delegate_to_pick_first,
additional_constraints_wrr_delegate_to_pick_first, true, true},
{"client_channel_subchannel_wrapper_work_serializer_orphan",
description_client_channel_subchannel_wrapper_work_serializer_orphan,
additional_constraints_client_channel_subchannel_wrapper_work_serializer_orphan,

@ -90,6 +90,8 @@ inline bool IsLazierStreamUpdatesEnabled() { return true; }
inline bool IsJitterMaxIdleEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_CHANNEL_SUBCHANNEL_WRAPPER_WORK_SERIALIZER_ORPHAN
inline bool IsClientChannelSubchannelWrapperWorkSerializerOrphanEnabled() {
return true;
@ -127,6 +129,8 @@ inline bool IsLazierStreamUpdatesEnabled() { return true; }
inline bool IsJitterMaxIdleEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_CHANNEL_SUBCHANNEL_WRAPPER_WORK_SERIALIZER_ORPHAN
inline bool IsClientChannelSubchannelWrapperWorkSerializerOrphanEnabled() {
return true;
@ -164,6 +168,8 @@ inline bool IsLazierStreamUpdatesEnabled() { return true; }
inline bool IsJitterMaxIdleEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_CHANNEL_SUBCHANNEL_WRAPPER_WORK_SERIALIZER_ORPHAN
inline bool IsClientChannelSubchannelWrapperWorkSerializerOrphanEnabled() {
return true;
@ -231,12 +237,16 @@ inline bool IsJitterMaxIdleEnabled() { return IsExperimentEnabled(23); }
inline bool IsRoundRobinDelegateToPickFirstEnabled() {
return IsExperimentEnabled(24);
}
#define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
inline bool IsWrrDelegateToPickFirstEnabled() {
return IsExperimentEnabled(25);
}
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_CHANNEL_SUBCHANNEL_WRAPPER_WORK_SERIALIZER_ORPHAN
inline bool IsClientChannelSubchannelWrapperWorkSerializerOrphanEnabled() {
return IsExperimentEnabled(25);
return IsExperimentEnabled(26);
}
constexpr const size_t kNumExperiments = 26;
constexpr const size_t kNumExperiments = 27;
extern const ExperimentMetadata g_experiment_metadata[kNumExperiments];
#endif

@ -202,6 +202,13 @@
expiry: 2023/11/15
owner: roth@google.com
test_tags: ["lb_unit_test", "cpp_lb_end2end_test", "xds_end2end_test"]
- name: wrr_delegate_to_pick_first
description:
Change WRR code to delegate to pick_first as per dualstack
backend design.
expiry: 2023/11/15
owner: roth@google.com
test_tags: ["lb_unit_test", "cpp_lb_end2end_test", "xds_end2end_test"]
- name: client_channel_subchannel_wrapper_work_serializer_orphan
description:
Client channel subchannel wrapper hops into WorkSerializer at

@ -98,5 +98,7 @@
default: true
- name: round_robin_delegate_to_pick_first
default: true
- name: wrr_delegate_to_pick_first
default: true
- name: client_channel_subchannel_wrapper_work_serializer_orphan
default: true

@ -127,8 +127,6 @@ class WeightedRoundRobinTest : public LoadBalancingPolicyTest {
EXPECT_EQ(ApplyUpdate(BuildUpdate(update_addresses, config_builder.Build()),
lb_policy()),
absl::OkStatus());
// Expect the initial CONNECTNG update with a picker that queues.
ExpectConnectingUpdate(location);
// RR should have created a subchannel for each address.
for (size_t i = 0; i < addresses.size(); ++i) {
auto* subchannel = FindSubchannel(addresses[i]);
@ -142,6 +140,8 @@ class WeightedRoundRobinTest : public LoadBalancingPolicyTest {
<< location.line();
// The subchannel will connect successfully.
subchannel->SetConnectivityState(GRPC_CHANNEL_CONNECTING);
// Expect the initial CONNECTNG update with a picker that queues.
if (i == 0) ExpectConnectingUpdate(location);
subchannel->SetConnectivityState(GRPC_CHANNEL_READY);
}
return WaitForConnected(location);

Loading…
Cancel
Save