grpc 1.58.3 → 1.59.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +48 -33
- data/include/grpc/event_engine/event_engine.h +6 -10
- data/include/grpc/impl/channel_arg_names.h +4 -0
- data/include/grpc/support/port_platform.h +74 -1
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +22 -9
- data/src/core/ext/filters/client_channel/client_channel.cc +422 -56
- data/src/core/ext/filters/client_channel/client_channel.h +52 -8
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +15 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -0
- data/src/core/ext/filters/client_channel/{http_proxy.cc → http_proxy_mapper.cc} +1 -1
- data/src/core/ext/filters/client_channel/{http_proxy.h → http_proxy_mapper.h} +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +188 -0
- data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +214 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +17 -4
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +41 -6
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +5 -3
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +32 -103
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +0 -7
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +416 -139
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +434 -459
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +410 -26
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -46
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +851 -57
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +16 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +47 -32
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +55 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +105 -175
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +14 -7
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +24 -6
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +36 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +54 -44
- data/src/core/ext/filters/client_channel/subchannel.cc +33 -0
- data/src/core/ext/filters/client_channel/subchannel.h +9 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -6
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +28 -22
- data/src/core/ext/transport/chttp2/transport/flow_control.h +27 -4
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +34 -36
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +66 -47
- data/src/core/ext/transport/chttp2/transport/{frame.h → legacy_frame.h} +3 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -2
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +10 -0
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +4 -0
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/writing.cc +2 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +9 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +16 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +75 -83
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +27 -29
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +102 -110
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +16 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +73 -81
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +65 -67
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +294 -302
- data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +42 -44
- data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +141 -149
- data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +4 -12
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +36 -38
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +157 -165
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +87 -89
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +372 -380
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -15
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +55 -63
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -113
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +441 -449
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -25
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +88 -96
- data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +40 -42
- data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +180 -188
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +26 -28
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +108 -116
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +65 -67
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +245 -253
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +27 -29
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +119 -127
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +6 -14
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +49 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +184 -192
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +49 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +225 -233
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +63 -65
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +246 -254
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +30 -38
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +28 -36
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +12 -14
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +48 -56
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +23 -25
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +92 -100
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +27 -29
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +108 -116
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +38 -40
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +167 -175
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +34 -36
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +162 -170
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +10 -12
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +37 -45
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +18 -26
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +22 -24
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +97 -105
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +24 -26
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +111 -119
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +43 -45
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +183 -191
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +20 -22
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +102 -110
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +253 -255
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +1108 -1116
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -39
- data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +35 -37
- data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +150 -158
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +14 -16
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +53 -61
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +23 -31
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +23 -31
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +114 -116
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +372 -380
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +30 -38
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +21 -23
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +81 -89
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +12 -14
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +52 -60
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +14 -22
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +114 -116
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +468 -476
- data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +25 -33
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +11 -13
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +40 -48
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +4 -12
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +27 -35
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +35 -37
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +165 -173
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +9 -11
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +32 -40
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +39 -41
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +169 -177
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +16 -24
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +55 -57
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +241 -249
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -39
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +23 -25
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +98 -106
- data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +11 -19
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +18 -26
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +16 -24
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +6 -14
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +33 -41
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +18 -26
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -39
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +34 -42
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +14 -16
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +47 -55
- data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +4 -12
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +12 -20
- data/src/core/ext/upb-generated/google/api/annotations.upb.c +2 -4
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -9
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +45 -47
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +190 -198
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +54 -56
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +210 -218
- data/src/core/ext/upb-generated/google/api/http.upb.c +15 -17
- data/src/core/ext/upb-generated/google/api/http.upb.h +60 -68
- data/src/core/ext/upb-generated/google/api/httpbody.upb.c +4 -6
- data/src/core/ext/upb-generated/google/api/httpbody.upb.h +15 -23
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +3 -5
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -15
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +359 -204
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1340 -760
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +3 -5
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -15
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -3
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -9
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +11 -13
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +43 -51
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +3 -5
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -15
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +10 -12
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +28 -36
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +4 -6
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +15 -23
- data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +11 -13
- data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +35 -43
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +10 -12
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +28 -36
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +48 -50
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +190 -198
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -7
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +15 -23
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +3 -5
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +7 -15
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +21 -23
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +80 -88
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +9 -11
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +29 -37
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +32 -34
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +147 -155
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +10 -12
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +13 -21
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -15
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +2 -4
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -9
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -6
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +7 -15
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -5
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +4 -12
- data/src/core/ext/upb-generated/validate/validate.upb.c +201 -203
- data/src/core/ext/upb-generated/validate/validate.upb.h +924 -932
- data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +10 -12
- data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +13 -21
- data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +7 -15
- data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +2 -4
- data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +1 -9
- data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +9 -11
- data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +16 -24
- data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +4 -12
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +2 -4
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +4 -12
- data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.h +8 -16
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +6 -8
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +20 -28
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +9 -17
- data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +8 -16
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +12 -20
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +9 -11
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +35 -43
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +5 -7
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +14 -22
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +16 -18
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +43 -51
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +13 -21
- data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.c +2 -4
- data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.h +5 -13
- data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.h +21 -29
- data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.c +1 -3
- data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.h +1 -9
- data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.c +5 -7
- data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.h +24 -32
- data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +24 -26
- data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +103 -111
- data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.c +10 -12
- data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.h +61 -69
- data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +9 -17
- data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +8 -10
- data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +33 -41
- data/src/core/ext/upb-generated/xds/type/v3/cel.upb.c +5 -7
- data/src/core/ext/upb-generated/xds/type/v3/cel.upb.h +18 -26
- data/src/core/ext/upb-generated/xds/type/v3/range.upb.c +7 -9
- data/src/core/ext/upb-generated/xds/type/v3/range.upb.h +19 -27
- data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +8 -16
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +367 -290
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +10 -0
- data/src/core/ext/xds/xds_client.cc +6 -9
- data/src/core/ext/xds/xds_client.h +2 -2
- data/src/core/ext/xds/xds_cluster.cc +30 -42
- data/src/core/ext/xds/xds_cluster.h +0 -4
- data/src/core/ext/xds/xds_endpoint.cc +12 -19
- data/src/core/ext/xds/xds_endpoint.h +0 -1
- data/src/core/ext/xds/xds_http_filters.cc +1 -4
- data/src/core/ext/xds/xds_listener.cc +14 -14
- data/src/core/ext/xds/xds_listener.h +13 -3
- data/src/core/ext/xds/xds_resource_type.h +1 -7
- data/src/core/ext/xds/xds_resource_type_impl.h +9 -11
- data/src/core/ext/xds/xds_route_config.cc +10 -11
- data/src/core/ext/xds/xds_route_config.h +1 -1
- data/src/core/ext/xds/xds_server_config_fetcher.cc +53 -28
- data/src/core/ext/xds/xds_transport_grpc.cc +11 -1
- data/src/core/lib/backoff/random_early_detection.cc +4 -2
- data/src/core/lib/backoff/random_early_detection.h +2 -4
- data/src/core/lib/channel/call_tracer.cc +7 -1
- data/src/core/lib/channel/call_tracer.h +4 -1
- data/src/core/lib/channel/channelz_registry.h +4 -2
- data/src/core/lib/channel/connected_channel.cc +1 -1
- data/src/core/lib/config/config_vars.h +1 -1
- data/src/core/lib/config/core_configuration.cc +2 -1
- data/src/core/lib/config/core_configuration.h +5 -4
- data/src/core/lib/debug/stats_data.cc +146 -51
- data/src/core/lib/debug/stats_data.h +81 -20
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +3 -0
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +3 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +3 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +3 -0
- data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +3 -0
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +15 -3
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.h +15 -0
- data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +3 -15
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +10 -4
- data/src/core/lib/experiments/config.cc +9 -1
- data/src/core/lib/experiments/experiments.cc +144 -60
- data/src/core/lib/experiments/experiments.h +146 -41
- data/src/core/lib/gprpp/fork.h +1 -1
- data/src/core/lib/gprpp/manual_constructor.h +1 -2
- data/src/core/lib/gprpp/no_destruct.h +1 -1
- data/src/core/lib/gprpp/per_cpu.cc +2 -0
- data/src/core/lib/gprpp/per_cpu.h +36 -7
- data/src/core/lib/gprpp/ref_counted_ptr.h +63 -0
- data/src/core/lib/gprpp/work_serializer.cc +297 -25
- data/src/core/lib/gprpp/work_serializer.h +25 -9
- data/src/core/lib/iomgr/combiner.cc +54 -15
- data/src/core/lib/iomgr/combiner.h +8 -3
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -4
- data/src/core/lib/iomgr/exec_ctx.cc +12 -0
- data/src/core/lib/iomgr/exec_ctx.h +55 -19
- data/src/core/lib/iomgr/polling_entity.cc +10 -0
- data/src/core/lib/iomgr/polling_entity.h +2 -0
- data/src/core/lib/iomgr/port.h +14 -0
- data/src/core/lib/iomgr/tcp_posix.cc +17 -14
- data/src/core/lib/load_balancing/lb_policy.h +10 -9
- data/src/core/lib/promise/arena_promise.h +5 -1
- data/src/core/lib/promise/detail/seq_state.h +418 -0
- data/src/core/lib/promise/latch.h +1 -0
- data/src/core/lib/promise/loop.h +8 -5
- data/src/core/lib/promise/pipe.h +24 -24
- data/src/core/lib/promise/poll.h +4 -6
- data/src/core/lib/resolver/server_address.h +1 -0
- data/src/core/lib/resource_quota/memory_quota.cc +58 -2
- data/src/core/lib/resource_quota/memory_quota.h +4 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +115 -9
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +14 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_match.cc +86 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +0 -59
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +2 -0
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +7 -57
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -14
- data/src/core/lib/slice/slice.h +6 -0
- data/src/core/lib/slice/slice_buffer.cc +15 -0
- data/src/core/lib/slice/slice_buffer.h +16 -4
- data/src/core/lib/slice/slice_refcount.h +1 -1
- data/src/core/lib/surface/call.cc +92 -34
- data/src/core/lib/surface/call.h +4 -0
- data/src/core/lib/surface/channel.cc +7 -4
- data/src/core/lib/surface/channel_init.h +3 -2
- data/src/core/lib/surface/server.cc +45 -5
- data/src/core/lib/surface/server.h +18 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/batch_builder.cc +3 -5
- data/src/core/lib/transport/metadata_batch.cc +6 -0
- data/src/core/lib/transport/metadata_batch.h +20 -1
- data/src/core/lib/transport/parsed_metadata.h +2 -4
- data/src/core/lib/transport/simple_slice_based_metadata.h +1 -2
- data/src/core/lib/transport/transport.h +21 -11
- data/src/core/tsi/ssl_transport_security.cc +7 -0
- data/src/core/tsi/ssl_transport_security.h +4 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/ext/grpc/rb_channel_args.c +6 -4
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +4 -1
- data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +185 -0
- data/third_party/upb/upb/collections/array.c +6 -0
- data/third_party/upb/upb/collections/array.h +6 -0
- data/third_party/upb/upb/collections/map.c +7 -0
- data/third_party/upb/upb/collections/map.h +5 -0
- data/third_party/upb/upb/collections/map_sorter_internal.h +1 -1
- data/third_party/upb/upb/collections/message_value.h +8 -1
- data/third_party/upb/upb/generated_code_support.h +54 -0
- data/third_party/upb/upb/hash/common.c +5 -0
- data/third_party/upb/upb/hash/common.h +1 -0
- data/third_party/upb/upb/hash/str_table.h +1 -0
- data/third_party/upb/upb/message/accessors.c +25 -1
- data/third_party/upb/upb/message/accessors.h +46 -25
- data/third_party/upb/upb/message/accessors_internal.h +69 -3
- data/third_party/upb/upb/message/extension_internal.h +1 -1
- data/third_party/upb/upb/message/internal/map_entry.h +64 -0
- data/third_party/upb/upb/message/internal.h +2 -6
- data/third_party/upb/upb/message/message.c +0 -6
- data/third_party/upb/upb/message/message.h +1 -1
- data/third_party/upb/upb/message/tagged_ptr.h +89 -0
- data/third_party/upb/upb/mini_descriptor/build_enum.c +150 -0
- data/third_party/upb/upb/mini_descriptor/build_enum.h +63 -0
- data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.c +122 -374
- data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.h +11 -50
- data/third_party/upb/upb/mini_descriptor/internal/base92.c +46 -0
- data/third_party/upb/upb/mini_descriptor/internal/base92.h +81 -0
- data/third_party/upb/upb/mini_descriptor/internal/decoder.h +73 -0
- data/third_party/upb/upb/{mini_table → mini_descriptor/internal}/encode.c +58 -32
- data/third_party/upb/upb/{mini_table/encode_internal.h → mini_descriptor/internal/encode.h} +3 -4
- data/third_party/upb/upb/{mini_table/encode_internal.hpp → mini_descriptor/internal/encode.hpp} +1 -1
- data/third_party/upb/upb/mini_descriptor/internal/modifiers.h +50 -0
- data/third_party/upb/upb/{mini_table/common_internal.h → mini_descriptor/internal/wire_constants.h} +3 -23
- data/third_party/upb/upb/mini_descriptor/link.c +142 -0
- data/third_party/upb/upb/mini_descriptor/link.h +104 -0
- data/third_party/upb/upb/mini_table/{types.h → enum.h} +19 -9
- data/third_party/upb/upb/mini_table/extension.h +40 -0
- data/third_party/upb/upb/mini_table/extension_registry.c +1 -1
- data/third_party/upb/upb/mini_table/extension_registry.h +2 -1
- data/third_party/upb/upb/mini_table/field.h +118 -0
- data/third_party/upb/upb/{json_decode.h → mini_table/file.h} +5 -6
- data/third_party/upb/upb/mini_table/{enum_internal.h → internal/enum.h} +7 -19
- data/third_party/upb/upb/mini_table/{extension_internal.h → internal/extension.h} +8 -8
- data/third_party/upb/upb/mini_table/{field_internal.h → internal/field.h} +10 -66
- data/third_party/upb/upb/mini_table/{file_internal.h → internal/file.h} +6 -4
- data/third_party/upb/upb/mini_table/internal/message.c +39 -0
- data/third_party/upb/upb/mini_table/{message_internal.h → internal/message.h} +14 -37
- data/third_party/upb/upb/mini_table/{sub_internal.h → internal/sub.h} +7 -6
- data/third_party/upb/upb/mini_table/{common.c → message.c} +2 -33
- data/third_party/upb/upb/mini_table/{common.h → message.h} +12 -77
- data/third_party/upb/upb/{json_encode.h → mini_table/sub.h} +5 -6
- data/third_party/upb/upb/reflection/def.hpp +16 -4
- data/third_party/upb/upb/reflection/def_pool_internal.h +1 -1
- data/third_party/upb/upb/reflection/desc_state_internal.h +1 -1
- data/third_party/upb/upb/reflection/enum_def.c +1 -1
- data/third_party/upb/upb/reflection/field_def.c +2 -1
- data/third_party/upb/upb/reflection/message.c +2 -2
- data/third_party/upb/upb/reflection/message_def.c +3 -1
- data/third_party/upb/upb/wire/decode.c +68 -29
- data/third_party/upb/upb/wire/decode.h +40 -0
- data/third_party/upb/upb/wire/encode.c +23 -13
- metadata +43 -27
- data/src/core/lib/event_engine/thread_pool/original_thread_pool.cc +0 -256
- data/src/core/lib/event_engine/thread_pool/original_thread_pool.h +0 -137
data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc
CHANGED
@@ -39,12 +39,14 @@
|
|
39
39
|
#include "absl/strings/str_join.h"
|
40
40
|
#include "absl/strings/string_view.h"
|
41
41
|
#include "absl/types/optional.h"
|
42
|
+
#include "absl/types/variant.h"
|
42
43
|
|
43
44
|
#include <grpc/event_engine/event_engine.h>
|
44
45
|
#include <grpc/impl/connectivity_state.h>
|
45
46
|
#include <grpc/support/log.h>
|
46
47
|
|
47
48
|
#include "src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h"
|
49
|
+
#include "src/core/ext/filters/client_channel/lb_policy/endpoint_list.h"
|
48
50
|
#include "src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h"
|
49
51
|
#include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
|
50
52
|
#include "src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h"
|
@@ -54,6 +56,7 @@
|
|
54
56
|
#include "src/core/lib/debug/stats.h"
|
55
57
|
#include "src/core/lib/debug/stats_data.h"
|
56
58
|
#include "src/core/lib/debug/trace.h"
|
59
|
+
#include "src/core/lib/experiments/experiments.h"
|
57
60
|
#include "src/core/lib/gprpp/debug_location.h"
|
58
61
|
#include "src/core/lib/gprpp/orphanable.h"
|
59
62
|
#include "src/core/lib/gprpp/ref_counted.h"
|
@@ -142,10 +145,10 @@ class WeightedRoundRobinConfig : public LoadBalancingPolicy::Config {
|
|
142
145
|
float error_utilization_penalty_ = 1.0;
|
143
146
|
};
|
144
147
|
|
145
|
-
// WRR LB policy
|
146
|
-
class
|
148
|
+
// Legacy WRR LB policy (not delegating to pick_first)
|
149
|
+
class OldWeightedRoundRobin : public LoadBalancingPolicy {
|
147
150
|
public:
|
148
|
-
explicit
|
151
|
+
explicit OldWeightedRoundRobin(Args args);
|
149
152
|
|
150
153
|
absl::string_view name() const override { return kWeightedRoundRobin; }
|
151
154
|
|
@@ -156,7 +159,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
156
159
|
// Represents the weight for a given address.
|
157
160
|
class AddressWeight : public RefCounted<AddressWeight> {
|
158
161
|
public:
|
159
|
-
AddressWeight(RefCountedPtr<
|
162
|
+
AddressWeight(RefCountedPtr<OldWeightedRoundRobin> wrr, std::string key)
|
160
163
|
: wrr_(std::move(wrr)), key_(std::move(key)) {}
|
161
164
|
~AddressWeight() override;
|
162
165
|
|
@@ -169,7 +172,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
169
172
|
void ResetNonEmptySince();
|
170
173
|
|
171
174
|
private:
|
172
|
-
RefCountedPtr<
|
175
|
+
RefCountedPtr<OldWeightedRoundRobin> wrr_;
|
173
176
|
const std::string key_;
|
174
177
|
|
175
178
|
Mutex mu_;
|
@@ -241,7 +244,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
241
244
|
: public SubchannelList<WeightedRoundRobinSubchannelList,
|
242
245
|
WeightedRoundRobinSubchannelData> {
|
243
246
|
public:
|
244
|
-
WeightedRoundRobinSubchannelList(
|
247
|
+
WeightedRoundRobinSubchannelList(OldWeightedRoundRobin* policy,
|
245
248
|
ServerAddressList addresses,
|
246
249
|
const ChannelArgs& args)
|
247
250
|
: SubchannelList(policy,
|
@@ -257,7 +260,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
257
260
|
}
|
258
261
|
|
259
262
|
~WeightedRoundRobinSubchannelList() override {
|
260
|
-
|
263
|
+
OldWeightedRoundRobin* p = static_cast<OldWeightedRoundRobin*>(policy());
|
261
264
|
p->Unref(DEBUG_LOCATION, "subchannel_list");
|
262
265
|
}
|
263
266
|
|
@@ -275,7 +278,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
275
278
|
|
276
279
|
private:
|
277
280
|
std::shared_ptr<WorkSerializer> work_serializer() const override {
|
278
|
-
return static_cast<
|
281
|
+
return static_cast<OldWeightedRoundRobin*>(policy())->work_serializer();
|
279
282
|
}
|
280
283
|
|
281
284
|
std::string CountersString() const {
|
@@ -296,7 +299,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
296
299
|
// endpoint-reported utilization and QPS.
|
297
300
|
class Picker : public SubchannelPicker {
|
298
301
|
public:
|
299
|
-
Picker(RefCountedPtr<
|
302
|
+
Picker(RefCountedPtr<OldWeightedRoundRobin> wrr,
|
300
303
|
WeightedRoundRobinSubchannelList* subchannel_list);
|
301
304
|
|
302
305
|
~Picker() override;
|
@@ -341,7 +344,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
341
344
|
void BuildSchedulerAndStartTimerLocked()
|
342
345
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&timer_mu_);
|
343
346
|
|
344
|
-
RefCountedPtr<
|
347
|
+
RefCountedPtr<OldWeightedRoundRobin> wrr_;
|
345
348
|
RefCountedPtr<WeightedRoundRobinConfig> config_;
|
346
349
|
std::vector<SubchannelInfo> subchannels_;
|
347
350
|
|
@@ -357,7 +360,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
357
360
|
std::atomic<size_t> last_picked_index_;
|
358
361
|
};
|
359
362
|
|
360
|
-
~
|
363
|
+
~OldWeightedRoundRobin() override;
|
361
364
|
|
362
365
|
void ShutdownLocked() override;
|
363
366
|
|
@@ -388,10 +391,10 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
388
391
|
};
|
389
392
|
|
390
393
|
//
|
391
|
-
//
|
394
|
+
// OldWeightedRoundRobin::AddressWeight
|
392
395
|
//
|
393
396
|
|
394
|
-
|
397
|
+
OldWeightedRoundRobin::AddressWeight::~AddressWeight() {
|
395
398
|
MutexLock lock(&wrr_->address_weight_map_mu_);
|
396
399
|
auto it = wrr_->address_weight_map_.find(key_);
|
397
400
|
if (it != wrr_->address_weight_map_.end() && it->second == this) {
|
@@ -399,7 +402,7 @@ WeightedRoundRobin::AddressWeight::~AddressWeight() {
|
|
399
402
|
}
|
400
403
|
}
|
401
404
|
|
402
|
-
void
|
405
|
+
void OldWeightedRoundRobin::AddressWeight::MaybeUpdateWeight(
|
403
406
|
double qps, double eps, double utilization,
|
404
407
|
float error_utilization_penalty) {
|
405
408
|
// Compute weight.
|
@@ -439,7 +442,7 @@ void WeightedRoundRobin::AddressWeight::MaybeUpdateWeight(
|
|
439
442
|
last_update_time_ = now;
|
440
443
|
}
|
441
444
|
|
442
|
-
float
|
445
|
+
float OldWeightedRoundRobin::AddressWeight::GetWeight(
|
443
446
|
Timestamp now, Duration weight_expiration_period,
|
444
447
|
Duration blackout_period) {
|
445
448
|
MutexLock lock(&mu_);
|
@@ -470,16 +473,16 @@ float WeightedRoundRobin::AddressWeight::GetWeight(
|
|
470
473
|
return weight_;
|
471
474
|
}
|
472
475
|
|
473
|
-
void
|
476
|
+
void OldWeightedRoundRobin::AddressWeight::ResetNonEmptySince() {
|
474
477
|
MutexLock lock(&mu_);
|
475
478
|
non_empty_since_ = Timestamp::InfFuture();
|
476
479
|
}
|
477
480
|
|
478
481
|
//
|
479
|
-
//
|
482
|
+
// OldWeightedRoundRobin::Picker::SubchannelCallTracker
|
480
483
|
//
|
481
484
|
|
482
|
-
void
|
485
|
+
void OldWeightedRoundRobin::Picker::SubchannelCallTracker::Finish(
|
483
486
|
FinishArgs args) {
|
484
487
|
auto* backend_metric_data =
|
485
488
|
args.backend_metric_accessor->GetBackendMetricData();
|
@@ -498,11 +501,11 @@ void WeightedRoundRobin::Picker::SubchannelCallTracker::Finish(
|
|
498
501
|
}
|
499
502
|
|
500
503
|
//
|
501
|
-
//
|
504
|
+
// OldWeightedRoundRobin::Picker
|
502
505
|
//
|
503
506
|
|
504
|
-
|
505
|
-
RefCountedPtr<
|
507
|
+
OldWeightedRoundRobin::Picker::Picker(
|
508
|
+
RefCountedPtr<OldWeightedRoundRobin> wrr,
|
506
509
|
WeightedRoundRobinSubchannelList* subchannel_list)
|
507
510
|
: wrr_(std::move(wrr)),
|
508
511
|
config_(wrr_->config_),
|
@@ -525,13 +528,13 @@ WeightedRoundRobin::Picker::Picker(
|
|
525
528
|
BuildSchedulerAndStartTimerLocked();
|
526
529
|
}
|
527
530
|
|
528
|
-
|
531
|
+
OldWeightedRoundRobin::Picker::~Picker() {
|
529
532
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
530
533
|
gpr_log(GPR_INFO, "[WRR %p picker %p] destroying picker", wrr_.get(), this);
|
531
534
|
}
|
532
535
|
}
|
533
536
|
|
534
|
-
void
|
537
|
+
void OldWeightedRoundRobin::Picker::Orphan() {
|
535
538
|
MutexLock lock(&timer_mu_);
|
536
539
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
537
540
|
gpr_log(GPR_INFO, "[WRR %p picker %p] cancelling timer", wrr_.get(), this);
|
@@ -540,7 +543,7 @@ void WeightedRoundRobin::Picker::Orphan() {
|
|
540
543
|
timer_handle_.reset();
|
541
544
|
}
|
542
545
|
|
543
|
-
|
546
|
+
OldWeightedRoundRobin::PickResult OldWeightedRoundRobin::Picker::Pick(
|
544
547
|
PickArgs /*args*/) {
|
545
548
|
size_t index = PickIndex();
|
546
549
|
GPR_ASSERT(index < subchannels_.size());
|
@@ -560,7 +563,7 @@ WeightedRoundRobin::PickResult WeightedRoundRobin::Picker::Pick(
|
|
560
563
|
std::move(subchannel_call_tracker));
|
561
564
|
}
|
562
565
|
|
563
|
-
size_t
|
566
|
+
size_t OldWeightedRoundRobin::Picker::PickIndex() {
|
564
567
|
// Grab a ref to the scheduler.
|
565
568
|
std::shared_ptr<StaticStrideScheduler> scheduler;
|
566
569
|
{
|
@@ -574,7 +577,7 @@ size_t WeightedRoundRobin::Picker::PickIndex() {
|
|
574
577
|
return last_picked_index_.fetch_add(1) % subchannels_.size();
|
575
578
|
}
|
576
579
|
|
577
|
-
void
|
580
|
+
void OldWeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
578
581
|
// Build scheduler.
|
579
582
|
const Timestamp now = Timestamp::Now();
|
580
583
|
std::vector<float> weights;
|
@@ -623,8 +626,12 @@ void WeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
|
623
626
|
self->BuildSchedulerAndStartTimerLocked();
|
624
627
|
}
|
625
628
|
}
|
626
|
-
|
627
|
-
|
629
|
+
if (!IsWorkSerializerDispatchEnabled()) {
|
630
|
+
// Release the picker ref inside the WorkSerializer.
|
631
|
+
work_serializer->Run([self = std::move(self)]() {}, DEBUG_LOCATION);
|
632
|
+
return;
|
633
|
+
}
|
634
|
+
self.reset();
|
628
635
|
});
|
629
636
|
}
|
630
637
|
|
@@ -632,14 +639,14 @@ void WeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
|
632
639
|
// WeightedRoundRobin
|
633
640
|
//
|
634
641
|
|
635
|
-
|
642
|
+
OldWeightedRoundRobin::OldWeightedRoundRobin(Args args)
|
636
643
|
: LoadBalancingPolicy(std::move(args)) {
|
637
644
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
638
645
|
gpr_log(GPR_INFO, "[WRR %p] Created", this);
|
639
646
|
}
|
640
647
|
}
|
641
648
|
|
642
|
-
|
649
|
+
OldWeightedRoundRobin::~OldWeightedRoundRobin() {
|
643
650
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
644
651
|
gpr_log(GPR_INFO, "[WRR %p] Destroying Round Robin policy", this);
|
645
652
|
}
|
@@ -647,7 +654,7 @@ WeightedRoundRobin::~WeightedRoundRobin() {
|
|
647
654
|
GPR_ASSERT(latest_pending_subchannel_list_ == nullptr);
|
648
655
|
}
|
649
656
|
|
650
|
-
void
|
657
|
+
void OldWeightedRoundRobin::ShutdownLocked() {
|
651
658
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
652
659
|
gpr_log(GPR_INFO, "[WRR %p] Shutting down", this);
|
653
660
|
}
|
@@ -656,14 +663,14 @@ void WeightedRoundRobin::ShutdownLocked() {
|
|
656
663
|
latest_pending_subchannel_list_.reset();
|
657
664
|
}
|
658
665
|
|
659
|
-
void
|
666
|
+
void OldWeightedRoundRobin::ResetBackoffLocked() {
|
660
667
|
subchannel_list_->ResetBackoffLocked();
|
661
668
|
if (latest_pending_subchannel_list_ != nullptr) {
|
662
669
|
latest_pending_subchannel_list_->ResetBackoffLocked();
|
663
670
|
}
|
664
671
|
}
|
665
672
|
|
666
|
-
absl::Status
|
673
|
+
absl::Status OldWeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
667
674
|
global_stats().IncrementWrrUpdates();
|
668
675
|
config_ = std::move(args.config);
|
669
676
|
ServerAddressList addresses;
|
@@ -738,8 +745,8 @@ absl::Status WeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
|
738
745
|
return absl::OkStatus();
|
739
746
|
}
|
740
747
|
|
741
|
-
RefCountedPtr<
|
742
|
-
|
748
|
+
RefCountedPtr<OldWeightedRoundRobin::AddressWeight>
|
749
|
+
OldWeightedRoundRobin::GetOrCreateWeight(const grpc_resolved_address& address) {
|
743
750
|
auto key = grpc_sockaddr_to_uri(&address);
|
744
751
|
if (!key.ok()) return nullptr;
|
745
752
|
MutexLock lock(&address_weight_map_mu_);
|
@@ -755,10 +762,10 @@ WeightedRoundRobin::GetOrCreateWeight(const grpc_resolved_address& address) {
|
|
755
762
|
}
|
756
763
|
|
757
764
|
//
|
758
|
-
//
|
765
|
+
// OldWeightedRoundRobin::WeightedRoundRobinSubchannelList
|
759
766
|
//
|
760
767
|
|
761
|
-
void
|
768
|
+
void OldWeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
762
769
|
UpdateStateCountersLocked(absl::optional<grpc_connectivity_state> old_state,
|
763
770
|
grpc_connectivity_state new_state) {
|
764
771
|
if (old_state.has_value()) {
|
@@ -784,9 +791,9 @@ void WeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
|
784
791
|
}
|
785
792
|
}
|
786
793
|
|
787
|
-
void
|
794
|
+
void OldWeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
788
795
|
MaybeUpdateAggregatedConnectivityStateLocked(absl::Status status_for_tf) {
|
789
|
-
|
796
|
+
OldWeightedRoundRobin* p = static_cast<OldWeightedRoundRobin*>(policy());
|
790
797
|
// If this is latest_pending_subchannel_list_, then swap it into
|
791
798
|
// subchannel_list_ in the following cases:
|
792
799
|
// - subchannel_list_ has no READY subchannels.
|
@@ -852,10 +859,10 @@ void WeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
|
852
859
|
}
|
853
860
|
|
854
861
|
//
|
855
|
-
//
|
862
|
+
// OldWeightedRoundRobin::WeightedRoundRobinSubchannelData::OobWatcher
|
856
863
|
//
|
857
864
|
|
858
|
-
void
|
865
|
+
void OldWeightedRoundRobin::WeightedRoundRobinSubchannelData::OobWatcher::
|
859
866
|
OnBackendMetricReport(const BackendMetricData& backend_metric_data) {
|
860
867
|
double utilization = backend_metric_data.application_utilization;
|
861
868
|
if (utilization <= 0) {
|
@@ -866,20 +873,20 @@ void WeightedRoundRobin::WeightedRoundRobinSubchannelData::OobWatcher::
|
|
866
873
|
}
|
867
874
|
|
868
875
|
//
|
869
|
-
//
|
876
|
+
// OldWeightedRoundRobin::WeightedRoundRobinSubchannelData
|
870
877
|
//
|
871
878
|
|
872
|
-
|
879
|
+
OldWeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
873
880
|
WeightedRoundRobinSubchannelData(
|
874
881
|
SubchannelList<WeightedRoundRobinSubchannelList,
|
875
882
|
WeightedRoundRobinSubchannelData>* subchannel_list,
|
876
883
|
const ServerAddress& address, RefCountedPtr<SubchannelInterface> sc)
|
877
884
|
: SubchannelData(subchannel_list, address, std::move(sc)),
|
878
|
-
weight_(static_cast<
|
885
|
+
weight_(static_cast<OldWeightedRoundRobin*>(subchannel_list->policy())
|
879
886
|
->GetOrCreateWeight(address.address())) {
|
880
887
|
// Start OOB watch if configured.
|
881
|
-
|
882
|
-
static_cast<
|
888
|
+
OldWeightedRoundRobin* p =
|
889
|
+
static_cast<OldWeightedRoundRobin*>(subchannel_list->policy());
|
883
890
|
if (p->config_->enable_oob_load_report()) {
|
884
891
|
subchannel()->AddDataWatcher(MakeOobBackendMetricWatcher(
|
885
892
|
p->config_->oob_reporting_period(),
|
@@ -888,12 +895,12 @@ WeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
|
888
895
|
}
|
889
896
|
}
|
890
897
|
|
891
|
-
void
|
898
|
+
void OldWeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
892
899
|
ProcessConnectivityChangeLocked(
|
893
900
|
absl::optional<grpc_connectivity_state> old_state,
|
894
901
|
grpc_connectivity_state new_state) {
|
895
|
-
|
896
|
-
static_cast<
|
902
|
+
OldWeightedRoundRobin* p =
|
903
|
+
static_cast<OldWeightedRoundRobin*>(subchannel_list()->policy());
|
897
904
|
GPR_ASSERT(subchannel() != nullptr);
|
898
905
|
// If this is not the initial state notification and the new state is
|
899
906
|
// TRANSIENT_FAILURE or IDLE, re-resolve.
|
@@ -940,11 +947,11 @@ void WeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
|
940
947
|
connectivity_status());
|
941
948
|
}
|
942
949
|
|
943
|
-
void
|
950
|
+
void OldWeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
944
951
|
UpdateLogicalConnectivityStateLocked(
|
945
952
|
grpc_connectivity_state connectivity_state) {
|
946
|
-
|
947
|
-
static_cast<
|
953
|
+
OldWeightedRoundRobin* p =
|
954
|
+
static_cast<OldWeightedRoundRobin*>(subchannel_list()->policy());
|
948
955
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
949
956
|
gpr_log(
|
950
957
|
GPR_INFO,
|
@@ -988,14 +995,801 @@ void WeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
|
988
995
|
logical_connectivity_state_ = connectivity_state;
|
989
996
|
}
|
990
997
|
|
998
|
+
// New WRR LB policy (with delegation to pick_first)
|
999
|
+
class WeightedRoundRobin : public LoadBalancingPolicy {
|
1000
|
+
public:
|
1001
|
+
explicit WeightedRoundRobin(Args args);
|
1002
|
+
|
1003
|
+
absl::string_view name() const override { return kWeightedRoundRobin; }
|
1004
|
+
|
1005
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
1006
|
+
void ResetBackoffLocked() override;
|
1007
|
+
|
1008
|
+
private:
|
1009
|
+
// Represents the weight for a given address.
|
1010
|
+
class EndpointWeight : public RefCounted<EndpointWeight> {
|
1011
|
+
public:
|
1012
|
+
EndpointWeight(RefCountedPtr<WeightedRoundRobin> wrr, std::string key)
|
1013
|
+
: wrr_(std::move(wrr)), key_(std::move(key)) {}
|
1014
|
+
~EndpointWeight() override;
|
1015
|
+
|
1016
|
+
void MaybeUpdateWeight(double qps, double eps, double utilization,
|
1017
|
+
float error_utilization_penalty);
|
1018
|
+
|
1019
|
+
float GetWeight(Timestamp now, Duration weight_expiration_period,
|
1020
|
+
Duration blackout_period);
|
1021
|
+
|
1022
|
+
void ResetNonEmptySince();
|
1023
|
+
|
1024
|
+
private:
|
1025
|
+
RefCountedPtr<WeightedRoundRobin> wrr_;
|
1026
|
+
const std::string key_;
|
1027
|
+
|
1028
|
+
Mutex mu_;
|
1029
|
+
float weight_ ABSL_GUARDED_BY(&mu_) = 0;
|
1030
|
+
Timestamp non_empty_since_ ABSL_GUARDED_BY(&mu_) = Timestamp::InfFuture();
|
1031
|
+
Timestamp last_update_time_ ABSL_GUARDED_BY(&mu_) = Timestamp::InfPast();
|
1032
|
+
};
|
1033
|
+
|
1034
|
+
class WrrEndpointList : public EndpointList {
|
1035
|
+
public:
|
1036
|
+
class WrrEndpoint : public Endpoint {
|
1037
|
+
public:
|
1038
|
+
WrrEndpoint(RefCountedPtr<WrrEndpointList> endpoint_list,
|
1039
|
+
const ServerAddress& address, const ChannelArgs& args,
|
1040
|
+
std::shared_ptr<WorkSerializer> work_serializer)
|
1041
|
+
: Endpoint(std::move(endpoint_list)),
|
1042
|
+
weight_(policy<WeightedRoundRobin>()->GetOrCreateWeight(
|
1043
|
+
address.address())) {
|
1044
|
+
Init(address, args, std::move(work_serializer));
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
RefCountedPtr<EndpointWeight> weight() const { return weight_; }
|
1048
|
+
|
1049
|
+
private:
|
1050
|
+
class OobWatcher : public OobBackendMetricWatcher {
|
1051
|
+
public:
|
1052
|
+
OobWatcher(RefCountedPtr<EndpointWeight> weight,
|
1053
|
+
float error_utilization_penalty)
|
1054
|
+
: weight_(std::move(weight)),
|
1055
|
+
error_utilization_penalty_(error_utilization_penalty) {}
|
1056
|
+
|
1057
|
+
void OnBackendMetricReport(
|
1058
|
+
const BackendMetricData& backend_metric_data) override;
|
1059
|
+
|
1060
|
+
private:
|
1061
|
+
RefCountedPtr<EndpointWeight> weight_;
|
1062
|
+
const float error_utilization_penalty_;
|
1063
|
+
};
|
1064
|
+
|
1065
|
+
RefCountedPtr<SubchannelInterface> CreateSubchannel(
|
1066
|
+
ServerAddress address, const ChannelArgs& args) override;
|
1067
|
+
|
1068
|
+
// Called when the child policy reports a connectivity state update.
|
1069
|
+
void OnStateUpdate(absl::optional<grpc_connectivity_state> old_state,
|
1070
|
+
grpc_connectivity_state new_state,
|
1071
|
+
const absl::Status& status) override;
|
1072
|
+
|
1073
|
+
RefCountedPtr<EndpointWeight> weight_;
|
1074
|
+
};
|
1075
|
+
|
1076
|
+
WrrEndpointList(RefCountedPtr<WeightedRoundRobin> wrr,
|
1077
|
+
const ServerAddressList& addresses, const ChannelArgs& args)
|
1078
|
+
: EndpointList(std::move(wrr),
|
1079
|
+
GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)
|
1080
|
+
? "WrrEndpointList"
|
1081
|
+
: nullptr) {
|
1082
|
+
Init(addresses, args,
|
1083
|
+
[&](RefCountedPtr<WrrEndpointList> endpoint_list,
|
1084
|
+
const ServerAddress& address, const ChannelArgs& args) {
|
1085
|
+
return MakeOrphanable<WrrEndpoint>(
|
1086
|
+
std::move(endpoint_list), address, args,
|
1087
|
+
policy<WeightedRoundRobin>()->work_serializer());
|
1088
|
+
});
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
private:
|
1092
|
+
LoadBalancingPolicy::ChannelControlHelper* channel_control_helper()
|
1093
|
+
const override {
|
1094
|
+
return policy<WeightedRoundRobin>()->channel_control_helper();
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
// Updates the counters of children in each state when a
|
1098
|
+
// child transitions from old_state to new_state.
|
1099
|
+
void UpdateStateCountersLocked(
|
1100
|
+
absl::optional<grpc_connectivity_state> old_state,
|
1101
|
+
grpc_connectivity_state new_state);
|
1102
|
+
|
1103
|
+
// Ensures that the right child list is used and then updates
|
1104
|
+
// the WRR policy's connectivity state based on the child list's
|
1105
|
+
// state counters.
|
1106
|
+
void MaybeUpdateAggregatedConnectivityStateLocked(
|
1107
|
+
absl::Status status_for_tf);
|
1108
|
+
|
1109
|
+
std::string CountersString() const {
|
1110
|
+
return absl::StrCat("num_children=", size(), " num_ready=", num_ready_,
|
1111
|
+
" num_connecting=", num_connecting_,
|
1112
|
+
" num_transient_failure=", num_transient_failure_);
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
size_t num_ready_ = 0;
|
1116
|
+
size_t num_connecting_ = 0;
|
1117
|
+
size_t num_transient_failure_ = 0;
|
1118
|
+
|
1119
|
+
absl::Status last_failure_;
|
1120
|
+
};
|
1121
|
+
|
1122
|
+
// A picker that performs WRR picks with weights based on
|
1123
|
+
// endpoint-reported utilization and QPS.
|
1124
|
+
class Picker : public SubchannelPicker {
|
1125
|
+
public:
|
1126
|
+
Picker(RefCountedPtr<WeightedRoundRobin> wrr,
|
1127
|
+
WrrEndpointList* endpoint_list);
|
1128
|
+
|
1129
|
+
~Picker() override;
|
1130
|
+
|
1131
|
+
PickResult Pick(PickArgs args) override;
|
1132
|
+
|
1133
|
+
void Orphan() override;
|
1134
|
+
|
1135
|
+
private:
|
1136
|
+
// A call tracker that collects per-call endpoint utilization reports.
|
1137
|
+
class SubchannelCallTracker : public SubchannelCallTrackerInterface {
|
1138
|
+
public:
|
1139
|
+
SubchannelCallTracker(
|
1140
|
+
RefCountedPtr<EndpointWeight> weight, float error_utilization_penalty,
|
1141
|
+
std::unique_ptr<SubchannelCallTrackerInterface> child_tracker)
|
1142
|
+
: weight_(std::move(weight)),
|
1143
|
+
error_utilization_penalty_(error_utilization_penalty),
|
1144
|
+
child_tracker_(std::move(child_tracker)) {}
|
1145
|
+
|
1146
|
+
void Start() override;
|
1147
|
+
|
1148
|
+
void Finish(FinishArgs args) override;
|
1149
|
+
|
1150
|
+
private:
|
1151
|
+
RefCountedPtr<EndpointWeight> weight_;
|
1152
|
+
const float error_utilization_penalty_;
|
1153
|
+
std::unique_ptr<SubchannelCallTrackerInterface> child_tracker_;
|
1154
|
+
};
|
1155
|
+
|
1156
|
+
// Info stored about each endpoint.
|
1157
|
+
struct EndpointInfo {
|
1158
|
+
EndpointInfo(RefCountedPtr<SubchannelPicker> picker,
|
1159
|
+
RefCountedPtr<EndpointWeight> weight)
|
1160
|
+
: picker(std::move(picker)), weight(std::move(weight)) {}
|
1161
|
+
|
1162
|
+
RefCountedPtr<SubchannelPicker> picker;
|
1163
|
+
RefCountedPtr<EndpointWeight> weight;
|
1164
|
+
};
|
1165
|
+
|
1166
|
+
// Returns the index into endpoints_ to be picked.
|
1167
|
+
size_t PickIndex();
|
1168
|
+
|
1169
|
+
// Builds a new scheduler and swaps it into place, then starts a
|
1170
|
+
// timer for the next update.
|
1171
|
+
void BuildSchedulerAndStartTimerLocked()
|
1172
|
+
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&timer_mu_);
|
1173
|
+
|
1174
|
+
RefCountedPtr<WeightedRoundRobin> wrr_;
|
1175
|
+
RefCountedPtr<WeightedRoundRobinConfig> config_;
|
1176
|
+
std::vector<EndpointInfo> endpoints_;
|
1177
|
+
|
1178
|
+
Mutex scheduler_mu_;
|
1179
|
+
std::shared_ptr<StaticStrideScheduler> scheduler_
|
1180
|
+
ABSL_GUARDED_BY(&scheduler_mu_);
|
1181
|
+
|
1182
|
+
Mutex timer_mu_ ABSL_ACQUIRED_BEFORE(&scheduler_mu_);
|
1183
|
+
absl::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>
|
1184
|
+
timer_handle_ ABSL_GUARDED_BY(&timer_mu_);
|
1185
|
+
|
1186
|
+
// Used when falling back to RR.
|
1187
|
+
std::atomic<size_t> last_picked_index_;
|
1188
|
+
};
|
1189
|
+
|
1190
|
+
~WeightedRoundRobin() override;
|
1191
|
+
|
1192
|
+
void ShutdownLocked() override;
|
1193
|
+
|
1194
|
+
RefCountedPtr<EndpointWeight> GetOrCreateWeight(
|
1195
|
+
const grpc_resolved_address& address);
|
1196
|
+
|
1197
|
+
RefCountedPtr<WeightedRoundRobinConfig> config_;
|
1198
|
+
|
1199
|
+
// List of endpoints.
|
1200
|
+
OrphanablePtr<WrrEndpointList> endpoint_list_;
|
1201
|
+
// Latest pending endpoint list.
|
1202
|
+
// When we get an updated address list, we create a new endpoint list
|
1203
|
+
// for it here, and we wait to swap it into endpoint_list_ until the new
|
1204
|
+
// list becomes READY.
|
1205
|
+
OrphanablePtr<WrrEndpointList> latest_pending_endpoint_list_;
|
1206
|
+
|
1207
|
+
Mutex endpoint_weight_map_mu_;
|
1208
|
+
std::map<std::string, EndpointWeight*, std::less<>> endpoint_weight_map_
|
1209
|
+
ABSL_GUARDED_BY(&endpoint_weight_map_mu_);
|
1210
|
+
|
1211
|
+
bool shutdown_ = false;
|
1212
|
+
|
1213
|
+
absl::BitGen bit_gen_;
|
1214
|
+
|
1215
|
+
// Accessed by picker.
|
1216
|
+
std::atomic<uint32_t> scheduler_state_{absl::Uniform<uint32_t>(bit_gen_)};
|
1217
|
+
};
|
1218
|
+
|
1219
|
+
//
|
1220
|
+
// WeightedRoundRobin::EndpointWeight
|
1221
|
+
//
|
1222
|
+
|
1223
|
+
WeightedRoundRobin::EndpointWeight::~EndpointWeight() {
|
1224
|
+
MutexLock lock(&wrr_->endpoint_weight_map_mu_);
|
1225
|
+
auto it = wrr_->endpoint_weight_map_.find(key_);
|
1226
|
+
if (it != wrr_->endpoint_weight_map_.end() && it->second == this) {
|
1227
|
+
wrr_->endpoint_weight_map_.erase(it);
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
void WeightedRoundRobin::EndpointWeight::MaybeUpdateWeight(
|
1232
|
+
double qps, double eps, double utilization,
|
1233
|
+
float error_utilization_penalty) {
|
1234
|
+
// Compute weight.
|
1235
|
+
float weight = 0;
|
1236
|
+
if (qps > 0 && utilization > 0) {
|
1237
|
+
double penalty = 0.0;
|
1238
|
+
if (eps > 0 && error_utilization_penalty > 0) {
|
1239
|
+
penalty = eps / qps * error_utilization_penalty;
|
1240
|
+
}
|
1241
|
+
weight = qps / (utilization + penalty);
|
1242
|
+
}
|
1243
|
+
if (weight == 0) {
|
1244
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1245
|
+
gpr_log(GPR_INFO,
|
1246
|
+
"[WRR %p] subchannel %s: qps=%f, eps=%f, utilization=%f: "
|
1247
|
+
"error_util_penalty=%f, weight=%f (not updating)",
|
1248
|
+
wrr_.get(), key_.c_str(), qps, eps, utilization,
|
1249
|
+
error_utilization_penalty, weight);
|
1250
|
+
}
|
1251
|
+
return;
|
1252
|
+
}
|
1253
|
+
Timestamp now = Timestamp::Now();
|
1254
|
+
// Grab the lock and update the data.
|
1255
|
+
MutexLock lock(&mu_);
|
1256
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1257
|
+
gpr_log(GPR_INFO,
|
1258
|
+
"[WRR %p] subchannel %s: qps=%f, eps=%f, utilization=%f "
|
1259
|
+
"error_util_penalty=%f : setting weight=%f weight_=%f now=%s "
|
1260
|
+
"last_update_time_=%s non_empty_since_=%s",
|
1261
|
+
wrr_.get(), key_.c_str(), qps, eps, utilization,
|
1262
|
+
error_utilization_penalty, weight, weight_, now.ToString().c_str(),
|
1263
|
+
last_update_time_.ToString().c_str(),
|
1264
|
+
non_empty_since_.ToString().c_str());
|
1265
|
+
}
|
1266
|
+
if (non_empty_since_ == Timestamp::InfFuture()) non_empty_since_ = now;
|
1267
|
+
weight_ = weight;
|
1268
|
+
last_update_time_ = now;
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
float WeightedRoundRobin::EndpointWeight::GetWeight(
|
1272
|
+
Timestamp now, Duration weight_expiration_period,
|
1273
|
+
Duration blackout_period) {
|
1274
|
+
MutexLock lock(&mu_);
|
1275
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1276
|
+
gpr_log(GPR_INFO,
|
1277
|
+
"[WRR %p] subchannel %s: getting weight: now=%s "
|
1278
|
+
"weight_expiration_period=%s blackout_period=%s "
|
1279
|
+
"last_update_time_=%s non_empty_since_=%s weight_=%f",
|
1280
|
+
wrr_.get(), key_.c_str(), now.ToString().c_str(),
|
1281
|
+
weight_expiration_period.ToString().c_str(),
|
1282
|
+
blackout_period.ToString().c_str(),
|
1283
|
+
last_update_time_.ToString().c_str(),
|
1284
|
+
non_empty_since_.ToString().c_str(), weight_);
|
1285
|
+
}
|
1286
|
+
// If the most recent update was longer ago than the expiration
|
1287
|
+
// period, reset non_empty_since_ so that we apply the blackout period
|
1288
|
+
// again if we start getting data again in the future, and return 0.
|
1289
|
+
if (now - last_update_time_ >= weight_expiration_period) {
|
1290
|
+
non_empty_since_ = Timestamp::InfFuture();
|
1291
|
+
return 0;
|
1292
|
+
}
|
1293
|
+
// If we don't have at least blackout_period worth of data, return 0.
|
1294
|
+
if (blackout_period > Duration::Zero() &&
|
1295
|
+
now - non_empty_since_ < blackout_period) {
|
1296
|
+
return 0;
|
1297
|
+
}
|
1298
|
+
// Otherwise, return the weight.
|
1299
|
+
return weight_;
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
void WeightedRoundRobin::EndpointWeight::ResetNonEmptySince() {
|
1303
|
+
MutexLock lock(&mu_);
|
1304
|
+
non_empty_since_ = Timestamp::InfFuture();
|
1305
|
+
}
|
1306
|
+
|
991
1307
|
//
|
992
|
-
//
|
1308
|
+
// WeightedRoundRobin::Picker::SubchannelCallTracker
|
993
1309
|
//
|
994
1310
|
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
1311
|
+
void WeightedRoundRobin::Picker::SubchannelCallTracker::Start() {
|
1312
|
+
if (child_tracker_ != nullptr) child_tracker_->Start();
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
void WeightedRoundRobin::Picker::SubchannelCallTracker::Finish(
|
1316
|
+
FinishArgs args) {
|
1317
|
+
if (child_tracker_ != nullptr) child_tracker_->Finish(args);
|
1318
|
+
auto* backend_metric_data =
|
1319
|
+
args.backend_metric_accessor->GetBackendMetricData();
|
1320
|
+
double qps = 0;
|
1321
|
+
double eps = 0;
|
1322
|
+
double utilization = 0;
|
1323
|
+
if (backend_metric_data != nullptr) {
|
1324
|
+
qps = backend_metric_data->qps;
|
1325
|
+
eps = backend_metric_data->eps;
|
1326
|
+
utilization = backend_metric_data->application_utilization;
|
1327
|
+
if (utilization <= 0) {
|
1328
|
+
utilization = backend_metric_data->cpu_utilization;
|
1329
|
+
}
|
1330
|
+
}
|
1331
|
+
weight_->MaybeUpdateWeight(qps, eps, utilization, error_utilization_penalty_);
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
//
|
1335
|
+
// WeightedRoundRobin::Picker
|
1336
|
+
//
|
1337
|
+
|
1338
|
+
WeightedRoundRobin::Picker::Picker(RefCountedPtr<WeightedRoundRobin> wrr,
|
1339
|
+
WrrEndpointList* endpoint_list)
|
1340
|
+
: wrr_(std::move(wrr)),
|
1341
|
+
config_(wrr_->config_),
|
1342
|
+
last_picked_index_(absl::Uniform<size_t>(wrr_->bit_gen_)) {
|
1343
|
+
for (auto& endpoint : endpoint_list->endpoints()) {
|
1344
|
+
auto* ep = static_cast<WrrEndpointList::WrrEndpoint*>(endpoint.get());
|
1345
|
+
if (ep->connectivity_state() == GRPC_CHANNEL_READY) {
|
1346
|
+
endpoints_.emplace_back(ep->picker(), ep->weight());
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
global_stats().IncrementWrrSubchannelListSize(endpoint_list->size());
|
1350
|
+
global_stats().IncrementWrrSubchannelReadySize(endpoints_.size());
|
1351
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1352
|
+
gpr_log(GPR_INFO,
|
1353
|
+
"[WRR %p picker %p] created picker from endpoint_list=%p "
|
1354
|
+
"with %" PRIuPTR " subchannels",
|
1355
|
+
wrr_.get(), this, endpoint_list, endpoints_.size());
|
1356
|
+
}
|
1357
|
+
BuildSchedulerAndStartTimerLocked();
|
1358
|
+
}
|
1359
|
+
|
1360
|
+
WeightedRoundRobin::Picker::~Picker() {
|
1361
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1362
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] destroying picker", wrr_.get(), this);
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
void WeightedRoundRobin::Picker::Orphan() {
|
1367
|
+
MutexLock lock(&timer_mu_);
|
1368
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1369
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] cancelling timer", wrr_.get(), this);
|
1370
|
+
}
|
1371
|
+
wrr_->channel_control_helper()->GetEventEngine()->Cancel(*timer_handle_);
|
1372
|
+
timer_handle_.reset();
|
1373
|
+
wrr_.reset();
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
WeightedRoundRobin::PickResult WeightedRoundRobin::Picker::Pick(PickArgs args) {
|
1377
|
+
size_t index = PickIndex();
|
1378
|
+
GPR_ASSERT(index < endpoints_.size());
|
1379
|
+
auto& endpoint_info = endpoints_[index];
|
1380
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1381
|
+
gpr_log(GPR_INFO,
|
1382
|
+
"[WRR %p picker %p] returning index %" PRIuPTR ", picker=%p",
|
1383
|
+
wrr_.get(), this, index, endpoint_info.picker.get());
|
1384
|
+
}
|
1385
|
+
auto result = endpoint_info.picker->Pick(args);
|
1386
|
+
// Collect per-call utilization data if needed.
|
1387
|
+
if (!config_->enable_oob_load_report()) {
|
1388
|
+
auto* complete = absl::get_if<PickResult::Complete>(&result.result);
|
1389
|
+
if (complete != nullptr) {
|
1390
|
+
complete->subchannel_call_tracker =
|
1391
|
+
std::make_unique<SubchannelCallTracker>(
|
1392
|
+
endpoint_info.weight, config_->error_utilization_penalty(),
|
1393
|
+
std::move(complete->subchannel_call_tracker));
|
1394
|
+
}
|
1395
|
+
}
|
1396
|
+
return result;
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
size_t WeightedRoundRobin::Picker::PickIndex() {
|
1400
|
+
// Grab a ref to the scheduler.
|
1401
|
+
std::shared_ptr<StaticStrideScheduler> scheduler;
|
1402
|
+
{
|
1403
|
+
MutexLock lock(&scheduler_mu_);
|
1404
|
+
scheduler = scheduler_;
|
1405
|
+
}
|
1406
|
+
// If we have a scheduler, use it to do a WRR pick.
|
1407
|
+
if (scheduler != nullptr) return scheduler->Pick();
|
1408
|
+
// We don't have a scheduler (i.e., either all of the weights are 0 or
|
1409
|
+
// there is only one subchannel), so fall back to RR.
|
1410
|
+
return last_picked_index_.fetch_add(1) % endpoints_.size();
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
void WeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
1414
|
+
// Build scheduler.
|
1415
|
+
const Timestamp now = Timestamp::Now();
|
1416
|
+
std::vector<float> weights;
|
1417
|
+
weights.reserve(endpoints_.size());
|
1418
|
+
for (const auto& endpoint : endpoints_) {
|
1419
|
+
weights.push_back(endpoint.weight->GetWeight(
|
1420
|
+
now, config_->weight_expiration_period(), config_->blackout_period()));
|
1421
|
+
}
|
1422
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1423
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] new weights: %s", wrr_.get(), this,
|
1424
|
+
absl::StrJoin(weights, " ").c_str());
|
1425
|
+
}
|
1426
|
+
auto scheduler_or = StaticStrideScheduler::Make(
|
1427
|
+
weights, [this]() { return wrr_->scheduler_state_.fetch_add(1); });
|
1428
|
+
std::shared_ptr<StaticStrideScheduler> scheduler;
|
1429
|
+
if (scheduler_or.has_value()) {
|
1430
|
+
scheduler =
|
1431
|
+
std::make_shared<StaticStrideScheduler>(std::move(*scheduler_or));
|
1432
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1433
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] new scheduler: %p", wrr_.get(),
|
1434
|
+
this, scheduler.get());
|
1435
|
+
}
|
1436
|
+
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1437
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] no scheduler, falling back to RR",
|
1438
|
+
wrr_.get(), this);
|
1439
|
+
}
|
1440
|
+
{
|
1441
|
+
MutexLock lock(&scheduler_mu_);
|
1442
|
+
scheduler_ = std::move(scheduler);
|
1443
|
+
}
|
1444
|
+
// Start timer.
|
1445
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1446
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] scheduling timer for %s", wrr_.get(),
|
1447
|
+
this, config_->weight_update_period().ToString().c_str());
|
1448
|
+
}
|
1449
|
+
WeakRefCountedPtr<Picker> self = WeakRef();
|
1450
|
+
timer_handle_ = wrr_->channel_control_helper()->GetEventEngine()->RunAfter(
|
1451
|
+
config_->weight_update_period(),
|
1452
|
+
[self = std::move(self),
|
1453
|
+
work_serializer = wrr_->work_serializer()]() mutable {
|
1454
|
+
ApplicationCallbackExecCtx callback_exec_ctx;
|
1455
|
+
ExecCtx exec_ctx;
|
1456
|
+
{
|
1457
|
+
MutexLock lock(&self->timer_mu_);
|
1458
|
+
if (self->timer_handle_.has_value()) {
|
1459
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1460
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] timer fired",
|
1461
|
+
self->wrr_.get(), self.get());
|
1462
|
+
}
|
1463
|
+
self->BuildSchedulerAndStartTimerLocked();
|
1464
|
+
}
|
1465
|
+
}
|
1466
|
+
if (!IsWorkSerializerDispatchEnabled()) {
|
1467
|
+
// Release the picker ref inside the WorkSerializer.
|
1468
|
+
work_serializer->Run([self = std::move(self)]() {}, DEBUG_LOCATION);
|
1469
|
+
return;
|
1470
|
+
}
|
1471
|
+
self.reset();
|
1472
|
+
});
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
//
|
1476
|
+
// WeightedRoundRobin
|
1477
|
+
//
|
1478
|
+
|
1479
|
+
WeightedRoundRobin::WeightedRoundRobin(Args args)
|
1480
|
+
: LoadBalancingPolicy(std::move(args)) {
|
1481
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1482
|
+
gpr_log(GPR_INFO, "[WRR %p] Created", this);
|
1483
|
+
}
|
1484
|
+
}
|
1485
|
+
|
1486
|
+
WeightedRoundRobin::~WeightedRoundRobin() {
|
1487
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1488
|
+
gpr_log(GPR_INFO, "[WRR %p] Destroying Round Robin policy", this);
|
1489
|
+
}
|
1490
|
+
GPR_ASSERT(endpoint_list_ == nullptr);
|
1491
|
+
GPR_ASSERT(latest_pending_endpoint_list_ == nullptr);
|
1492
|
+
}
|
1493
|
+
|
1494
|
+
void WeightedRoundRobin::ShutdownLocked() {
|
1495
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1496
|
+
gpr_log(GPR_INFO, "[WRR %p] Shutting down", this);
|
1497
|
+
}
|
1498
|
+
shutdown_ = true;
|
1499
|
+
endpoint_list_.reset();
|
1500
|
+
latest_pending_endpoint_list_.reset();
|
1501
|
+
}
|
1502
|
+
|
1503
|
+
void WeightedRoundRobin::ResetBackoffLocked() {
|
1504
|
+
endpoint_list_->ResetBackoffLocked();
|
1505
|
+
if (latest_pending_endpoint_list_ != nullptr) {
|
1506
|
+
latest_pending_endpoint_list_->ResetBackoffLocked();
|
1507
|
+
}
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
absl::Status WeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
1511
|
+
global_stats().IncrementWrrUpdates();
|
1512
|
+
config_ = std::move(args.config);
|
1513
|
+
ServerAddressList addresses;
|
1514
|
+
if (args.addresses.ok()) {
|
1515
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1516
|
+
gpr_log(GPR_INFO, "[WRR %p] received update with %" PRIuPTR " addresses",
|
1517
|
+
this, args.addresses->size());
|
1518
|
+
}
|
1519
|
+
// Weed out duplicate addresses. Also sort the addresses so that if
|
1520
|
+
// the set of the addresses don't change, their indexes in the
|
1521
|
+
// subchannel list don't change, since this avoids unnecessary churn
|
1522
|
+
// in the picker. Note that this does not ensure that if a given
|
1523
|
+
// address remains present that it will have the same index; if,
|
1524
|
+
// for example, an address at the end of the list is replaced with one
|
1525
|
+
// that sorts much earlier in the list, then all of the addresses in
|
1526
|
+
// between those two positions will have changed indexes.
|
1527
|
+
struct AddressLessThan {
|
1528
|
+
bool operator()(const ServerAddress& address1,
|
1529
|
+
const ServerAddress& address2) const {
|
1530
|
+
const grpc_resolved_address& addr1 = address1.address();
|
1531
|
+
const grpc_resolved_address& addr2 = address2.address();
|
1532
|
+
if (addr1.len != addr2.len) return addr1.len < addr2.len;
|
1533
|
+
return memcmp(addr1.addr, addr2.addr, addr1.len) < 0;
|
1534
|
+
}
|
1535
|
+
};
|
1536
|
+
std::set<ServerAddress, AddressLessThan> ordered_addresses(
|
1537
|
+
args.addresses->begin(), args.addresses->end());
|
1538
|
+
addresses =
|
1539
|
+
ServerAddressList(ordered_addresses.begin(), ordered_addresses.end());
|
1540
|
+
} else {
|
1541
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1542
|
+
gpr_log(GPR_INFO, "[WRR %p] received update with address error: %s", this,
|
1543
|
+
args.addresses.status().ToString().c_str());
|
1544
|
+
}
|
1545
|
+
// If we already have a subchannel list, then keep using the existing
|
1546
|
+
// list, but still report back that the update was not accepted.
|
1547
|
+
if (endpoint_list_ != nullptr) return args.addresses.status();
|
1548
|
+
}
|
1549
|
+
// Create new subchannel list, replacing the previous pending list, if any.
|
1550
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace) &&
|
1551
|
+
latest_pending_endpoint_list_ != nullptr) {
|
1552
|
+
gpr_log(GPR_INFO, "[WRR %p] replacing previous pending subchannel list %p",
|
1553
|
+
this, latest_pending_endpoint_list_.get());
|
1554
|
+
}
|
1555
|
+
latest_pending_endpoint_list_ =
|
1556
|
+
MakeOrphanable<WrrEndpointList>(Ref(), std::move(addresses), args.args);
|
1557
|
+
// If the new list is empty, immediately promote it to
|
1558
|
+
// endpoint_list_ and report TRANSIENT_FAILURE.
|
1559
|
+
// TODO(roth): As part of adding dualstack backend support, we need to
|
1560
|
+
// also handle the case where the list of addresses for a given
|
1561
|
+
// endpoint is empty.
|
1562
|
+
if (latest_pending_endpoint_list_->size() == 0) {
|
1563
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace) &&
|
1564
|
+
endpoint_list_ != nullptr) {
|
1565
|
+
gpr_log(GPR_INFO, "[WRR %p] replacing previous subchannel list %p", this,
|
1566
|
+
endpoint_list_.get());
|
1567
|
+
}
|
1568
|
+
endpoint_list_ = std::move(latest_pending_endpoint_list_);
|
1569
|
+
absl::Status status =
|
1570
|
+
args.addresses.ok() ? absl::UnavailableError(absl::StrCat(
|
1571
|
+
"empty address list: ", args.resolution_note))
|
1572
|
+
: args.addresses.status();
|
1573
|
+
channel_control_helper()->UpdateState(
|
1574
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
1575
|
+
MakeRefCounted<TransientFailurePicker>(status));
|
1576
|
+
return status;
|
1577
|
+
}
|
1578
|
+
// Otherwise, if this is the initial update, immediately promote it to
|
1579
|
+
// endpoint_list_.
|
1580
|
+
if (endpoint_list_.get() == nullptr) {
|
1581
|
+
endpoint_list_ = std::move(latest_pending_endpoint_list_);
|
1582
|
+
}
|
1583
|
+
return absl::OkStatus();
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
RefCountedPtr<WeightedRoundRobin::EndpointWeight>
|
1587
|
+
WeightedRoundRobin::GetOrCreateWeight(const grpc_resolved_address& address) {
|
1588
|
+
auto key = grpc_sockaddr_to_uri(&address);
|
1589
|
+
if (!key.ok()) return nullptr;
|
1590
|
+
MutexLock lock(&endpoint_weight_map_mu_);
|
1591
|
+
auto it = endpoint_weight_map_.find(*key);
|
1592
|
+
if (it != endpoint_weight_map_.end()) {
|
1593
|
+
auto weight = it->second->RefIfNonZero();
|
1594
|
+
if (weight != nullptr) return weight;
|
1595
|
+
}
|
1596
|
+
auto weight = MakeRefCounted<EndpointWeight>(
|
1597
|
+
Ref(DEBUG_LOCATION, "EndpointWeight"), *key);
|
1598
|
+
endpoint_weight_map_.emplace(*key, weight.get());
|
1599
|
+
return weight;
|
1600
|
+
}
|
1601
|
+
|
1602
|
+
//
|
1603
|
+
// WeightedRoundRobin::WrrEndpointList::WrrEndpoint::OobWatcher
|
1604
|
+
//
|
1605
|
+
|
1606
|
+
void WeightedRoundRobin::WrrEndpointList::WrrEndpoint::OobWatcher::
|
1607
|
+
OnBackendMetricReport(const BackendMetricData& backend_metric_data) {
|
1608
|
+
double utilization = backend_metric_data.application_utilization;
|
1609
|
+
if (utilization <= 0) {
|
1610
|
+
utilization = backend_metric_data.cpu_utilization;
|
1611
|
+
}
|
1612
|
+
weight_->MaybeUpdateWeight(backend_metric_data.qps, backend_metric_data.eps,
|
1613
|
+
utilization, error_utilization_penalty_);
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
//
|
1617
|
+
// WeightedRoundRobin::WrrEndpointList::WrrEndpoint
|
1618
|
+
//
|
1619
|
+
|
1620
|
+
RefCountedPtr<SubchannelInterface>
|
1621
|
+
WeightedRoundRobin::WrrEndpointList::WrrEndpoint::CreateSubchannel(
|
1622
|
+
ServerAddress address, const ChannelArgs& args) {
|
1623
|
+
auto* wrr = policy<WeightedRoundRobin>();
|
1624
|
+
auto subchannel =
|
1625
|
+
wrr->channel_control_helper()->CreateSubchannel(std::move(address), args);
|
1626
|
+
// Start OOB watch if configured.
|
1627
|
+
if (wrr->config_->enable_oob_load_report()) {
|
1628
|
+
subchannel->AddDataWatcher(MakeOobBackendMetricWatcher(
|
1629
|
+
wrr->config_->oob_reporting_period(),
|
1630
|
+
std::make_unique<OobWatcher>(
|
1631
|
+
weight_, wrr->config_->error_utilization_penalty())));
|
1632
|
+
}
|
1633
|
+
return subchannel;
|
1634
|
+
}
|
1635
|
+
|
1636
|
+
void WeightedRoundRobin::WrrEndpointList::WrrEndpoint::OnStateUpdate(
|
1637
|
+
absl::optional<grpc_connectivity_state> old_state,
|
1638
|
+
grpc_connectivity_state new_state, const absl::Status& status) {
|
1639
|
+
auto* wrr_endpoint_list = endpoint_list<WrrEndpointList>();
|
1640
|
+
auto* wrr = policy<WeightedRoundRobin>();
|
1641
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1642
|
+
gpr_log(GPR_INFO,
|
1643
|
+
"[WRR %p] connectivity changed for child %p, endpoint_list %p "
|
1644
|
+
"(index %" PRIuPTR " of %" PRIuPTR
|
1645
|
+
"): prev_state=%s new_state=%s (%s)",
|
1646
|
+
wrr, this, wrr_endpoint_list, Index(), wrr_endpoint_list->size(),
|
1647
|
+
(old_state.has_value() ? ConnectivityStateName(*old_state) : "N/A"),
|
1648
|
+
ConnectivityStateName(new_state), status.ToString().c_str());
|
1649
|
+
}
|
1650
|
+
if (new_state == GRPC_CHANNEL_IDLE) {
|
1651
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1652
|
+
gpr_log(GPR_INFO,
|
1653
|
+
"[WRR %p] child %p reported IDLE; requesting connection", wrr,
|
1654
|
+
this);
|
1655
|
+
}
|
1656
|
+
ExitIdleLocked();
|
1657
|
+
} else if (new_state == GRPC_CHANNEL_READY) {
|
1658
|
+
// If we transition back to READY state, restart the blackout period.
|
1659
|
+
// Skip this if this is the initial notification for this
|
1660
|
+
// subchannel (which happens whenever we get updated addresses and
|
1661
|
+
// create a new endpoint list). Also skip it if the previous state
|
1662
|
+
// was READY (which should never happen in practice, but we've seen
|
1663
|
+
// at least one bug that caused this in the outlier_detection
|
1664
|
+
// policy, so let's be defensive here).
|
1665
|
+
//
|
1666
|
+
// Note that we cannot guarantee that we will never receive
|
1667
|
+
// lingering callbacks for backend metric reports from the previous
|
1668
|
+
// connection after the new connection has been established, but they
|
1669
|
+
// should be masked by new backend metric reports from the new
|
1670
|
+
// connection by the time the blackout period ends.
|
1671
|
+
if (old_state.has_value() && old_state != GRPC_CHANNEL_READY) {
|
1672
|
+
weight_->ResetNonEmptySince();
|
1673
|
+
}
|
1674
|
+
}
|
1675
|
+
// If state changed, update state counters.
|
1676
|
+
if (!old_state.has_value() || *old_state != new_state) {
|
1677
|
+
wrr_endpoint_list->UpdateStateCountersLocked(old_state, new_state);
|
1678
|
+
}
|
1679
|
+
// Update the policy state.
|
1680
|
+
wrr_endpoint_list->MaybeUpdateAggregatedConnectivityStateLocked(status);
|
1681
|
+
}
|
1682
|
+
|
1683
|
+
//
|
1684
|
+
// WeightedRoundRobin::WrrEndpointList
|
1685
|
+
//
|
1686
|
+
|
1687
|
+
void WeightedRoundRobin::WrrEndpointList::UpdateStateCountersLocked(
|
1688
|
+
absl::optional<grpc_connectivity_state> old_state,
|
1689
|
+
grpc_connectivity_state new_state) {
|
1690
|
+
// We treat IDLE the same as CONNECTING, since it will immediately
|
1691
|
+
// transition into that state anyway.
|
1692
|
+
if (old_state.has_value()) {
|
1693
|
+
GPR_ASSERT(*old_state != GRPC_CHANNEL_SHUTDOWN);
|
1694
|
+
if (*old_state == GRPC_CHANNEL_READY) {
|
1695
|
+
GPR_ASSERT(num_ready_ > 0);
|
1696
|
+
--num_ready_;
|
1697
|
+
} else if (*old_state == GRPC_CHANNEL_CONNECTING ||
|
1698
|
+
*old_state == GRPC_CHANNEL_IDLE) {
|
1699
|
+
GPR_ASSERT(num_connecting_ > 0);
|
1700
|
+
--num_connecting_;
|
1701
|
+
} else if (*old_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
1702
|
+
GPR_ASSERT(num_transient_failure_ > 0);
|
1703
|
+
--num_transient_failure_;
|
1704
|
+
}
|
1705
|
+
}
|
1706
|
+
GPR_ASSERT(new_state != GRPC_CHANNEL_SHUTDOWN);
|
1707
|
+
if (new_state == GRPC_CHANNEL_READY) {
|
1708
|
+
++num_ready_;
|
1709
|
+
} else if (new_state == GRPC_CHANNEL_CONNECTING ||
|
1710
|
+
new_state == GRPC_CHANNEL_IDLE) {
|
1711
|
+
++num_connecting_;
|
1712
|
+
} else if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
1713
|
+
++num_transient_failure_;
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
void WeightedRoundRobin::WrrEndpointList::
|
1718
|
+
MaybeUpdateAggregatedConnectivityStateLocked(absl::Status status_for_tf) {
|
1719
|
+
auto* wrr = policy<WeightedRoundRobin>();
|
1720
|
+
// If this is latest_pending_endpoint_list_, then swap it into
|
1721
|
+
// endpoint_list_ in the following cases:
|
1722
|
+
// - endpoint_list_ has no READY children.
|
1723
|
+
// - This list has at least one READY child and we have seen the
|
1724
|
+
// initial connectivity state notification for all children.
|
1725
|
+
// - All of the children in this list are in TRANSIENT_FAILURE.
|
1726
|
+
// (This may cause the channel to go from READY to TRANSIENT_FAILURE,
|
1727
|
+
// but we're doing what the control plane told us to do.)
|
1728
|
+
if (wrr->latest_pending_endpoint_list_.get() == this &&
|
1729
|
+
(wrr->endpoint_list_->num_ready_ == 0 ||
|
1730
|
+
(num_ready_ > 0 && AllEndpointsSeenInitialState()) ||
|
1731
|
+
num_transient_failure_ == size())) {
|
1732
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1733
|
+
const std::string old_counters_string =
|
1734
|
+
wrr->endpoint_list_ != nullptr ? wrr->endpoint_list_->CountersString()
|
1735
|
+
: "";
|
1736
|
+
gpr_log(GPR_INFO,
|
1737
|
+
"[WRR %p] swapping out endpoint list %p (%s) in favor of %p (%s)",
|
1738
|
+
wrr, wrr->endpoint_list_.get(), old_counters_string.c_str(), this,
|
1739
|
+
CountersString().c_str());
|
1740
|
+
}
|
1741
|
+
wrr->endpoint_list_ = std::move(wrr->latest_pending_endpoint_list_);
|
1742
|
+
}
|
1743
|
+
// Only set connectivity state if this is the current endpoint list.
|
1744
|
+
if (wrr->endpoint_list_.get() != this) return;
|
1745
|
+
// First matching rule wins:
|
1746
|
+
// 1) ANY child is READY => policy is READY.
|
1747
|
+
// 2) ANY child is CONNECTING => policy is CONNECTING.
|
1748
|
+
// 3) ALL children are TRANSIENT_FAILURE => policy is TRANSIENT_FAILURE.
|
1749
|
+
if (num_ready_ > 0) {
|
1750
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1751
|
+
gpr_log(GPR_INFO, "[WRR %p] reporting READY with endpoint list %p", wrr,
|
1752
|
+
this);
|
1753
|
+
}
|
1754
|
+
wrr->channel_control_helper()->UpdateState(
|
1755
|
+
GRPC_CHANNEL_READY, absl::Status(),
|
1756
|
+
MakeRefCounted<Picker>(wrr->Ref(), this));
|
1757
|
+
} else if (num_connecting_ > 0) {
|
1758
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1759
|
+
gpr_log(GPR_INFO, "[WRR %p] reporting CONNECTING with endpoint list %p",
|
1760
|
+
wrr, this);
|
1761
|
+
}
|
1762
|
+
wrr->channel_control_helper()->UpdateState(
|
1763
|
+
GRPC_CHANNEL_CONNECTING, absl::Status(),
|
1764
|
+
MakeRefCounted<QueuePicker>(nullptr));
|
1765
|
+
} else if (num_transient_failure_ == size()) {
|
1766
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1767
|
+
gpr_log(GPR_INFO,
|
1768
|
+
"[WRR %p] reporting TRANSIENT_FAILURE with endpoint list %p: %s",
|
1769
|
+
wrr, this, status_for_tf.ToString().c_str());
|
1770
|
+
}
|
1771
|
+
if (!status_for_tf.ok()) {
|
1772
|
+
last_failure_ = absl::UnavailableError(
|
1773
|
+
absl::StrCat("connections to all backends failing; last error: ",
|
1774
|
+
status_for_tf.ToString()));
|
1775
|
+
}
|
1776
|
+
wrr->channel_control_helper()->UpdateState(
|
1777
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE, last_failure_,
|
1778
|
+
MakeRefCounted<TransientFailurePicker>(last_failure_));
|
1779
|
+
}
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
//
|
1783
|
+
// factory
|
1784
|
+
//
|
1785
|
+
|
1786
|
+
class WeightedRoundRobinFactory : public LoadBalancingPolicyFactory {
|
1787
|
+
public:
|
1788
|
+
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
|
1789
|
+
LoadBalancingPolicy::Args args) const override {
|
1790
|
+
if (!IsWrrDelegateToPickFirstEnabled()) {
|
1791
|
+
return MakeOrphanable<OldWeightedRoundRobin>(std::move(args));
|
1792
|
+
}
|
999
1793
|
return MakeOrphanable<WeightedRoundRobin>(std::move(args));
|
1000
1794
|
}
|
1001
1795
|
|