grpc 1.52.0 → 1.53.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +50 -5
- data/include/grpc/event_engine/event_engine.h +24 -2
- data/include/grpc/event_engine/slice_buffer.h +13 -1
- data/include/grpc/impl/grpc_types.h +3 -0
- data/include/grpc/support/time.h +6 -4
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +148 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +52 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_provider.h +29 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +3 -3
- data/src/core/ext/filters/channel_idle/idle_filter_state.h +3 -3
- data/src/core/ext/filters/client_channel/backend_metric.h +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.h +3 -3
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +29 -33
- data/src/core/ext/filters/client_channel/client_channel.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_factory.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_service_config.h +3 -3
- data/src/core/ext/filters/client_channel/config_selector.h +3 -3
- data/src/core/ext/filters/client_channel/connector.h +8 -4
- data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -3
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -3
- data/src/core/ext/filters/client_channel/lb_call_state_internal.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +1 -78
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +117 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +128 -0
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h +71 -0
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +972 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +12 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +275 -107
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +10 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +5 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +6 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +1 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +3 -7
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +3 -3
- data/src/core/ext/filters/client_channel/retry_filter.cc +10 -13
- data/src/core/ext/filters/client_channel/retry_filter.h +3 -3
- data/src/core/ext/filters/client_channel/retry_service_config.h +3 -3
- data/src/core/ext/filters/client_channel/retry_throttle.h +3 -3
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +4 -4
- data/src/core/ext/filters/client_channel/subchannel.cc +5 -1
- data/src/core/ext/filters/client_channel/subchannel.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.h +3 -3
- data/src/core/ext/filters/deadline/deadline_filter.cc +40 -48
- data/src/core/ext/filters/deadline/deadline_filter.h +6 -10
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +3 -3
- data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h +3 -3
- data/src/core/ext/filters/http/client/http_client_filter.cc +26 -21
- data/src/core/ext/filters/http/client/http_client_filter.h +3 -3
- data/src/core/ext/filters/http/client_authority_filter.h +3 -3
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +109 -117
- data/src/core/ext/filters/http/message_compress/compression_filter.h +17 -10
- data/src/core/ext/filters/http/server/http_server_filter.cc +25 -24
- data/src/core/ext/filters/http/server/http_server_filter.h +3 -3
- data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
- data/src/core/ext/filters/message_size/message_size_filter.h +3 -3
- data/src/core/ext/filters/rbac/rbac_filter.cc +4 -3
- data/src/core/ext/filters/rbac/rbac_filter.h +3 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +3 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.h +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +27 -37
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +5 -5
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +3 -3
- data/src/core/ext/transport/chttp2/alpn/alpn.h +3 -3
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +3 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +3 -3
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +3 -3
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +195 -111
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
- data/src/core/ext/transport/chttp2/transport/context_list.h +3 -3
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_constants.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +18 -407
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -3
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +3 -3
- data/src/core/ext/transport/chttp2/transport/http_trace.h +3 -3
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +3 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +28 -23
- data/src/core/ext/transport/chttp2/transport/parsing.cc +111 -31
- data/src/core/ext/transport/chttp2/transport/stream_map.h +3 -3
- data/src/core/ext/transport/chttp2/transport/varint.h +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +9 -8
- data/src/core/ext/transport/inproc/inproc_transport.h +3 -3
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +9 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +38 -2
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +185 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +7 -3
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +44 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +16 -25
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +48 -74
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +30 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +137 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +15 -12
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +83 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +15 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +17 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +61 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +11 -5
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +37 -6
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +22 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +6 -3
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -5
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +50 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +57 -16
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +254 -17
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +9 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +9 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +7 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +21 -12
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -3
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +23 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +10 -7
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +42 -12
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +54 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +188 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +111 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +444 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +7 -3
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +8 -6
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +31 -9
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +113 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +43 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +114 -0
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +3 -1
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.c +54 -53
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.c +34 -13
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +195 -187
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +232 -224
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +0 -5
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +95 -75
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +94 -93
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +81 -75
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +189 -187
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +7 -3
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +71 -66
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +137 -133
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +16 -12
- data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +140 -133
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +81 -70
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +771 -741
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.c +16 -14
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opentelemetry.upbdefs.c +14 -13
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.c +20 -18
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +53 -42
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +363 -356
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +149 -145
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +16 -13
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.c +48 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +14 -14
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.c +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.c +10 -9
- data/src/core/ext/xds/certificate_provider_store.h +3 -3
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +1 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +3 -3
- data/src/core/ext/xds/upb_utils.h +3 -3
- data/src/core/ext/xds/xds_api.h +3 -3
- data/src/core/ext/xds/xds_bootstrap.h +3 -3
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +1 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +3 -3
- data/src/core/ext/xds/xds_certificate_provider.h +3 -3
- data/src/core/ext/xds/xds_channel_args.h +3 -3
- data/src/core/ext/xds/xds_channel_stack_modifier.h +3 -3
- data/src/core/ext/xds/xds_client.cc +8 -3
- data/src/core/ext/xds/xds_client.h +3 -3
- data/src/core/ext/xds/xds_client_grpc.cc +0 -1
- data/src/core/ext/xds/xds_client_grpc.h +3 -3
- data/src/core/ext/xds/xds_client_stats.h +4 -3
- data/src/core/ext/xds/xds_cluster.cc +11 -7
- data/src/core/ext/xds/xds_cluster.h +6 -6
- data/src/core/ext/xds/xds_cluster_specifier_plugin.h +3 -3
- data/src/core/ext/xds/xds_common_types.cc +1 -0
- data/src/core/ext/xds/xds_common_types.h +3 -3
- data/src/core/ext/xds/xds_endpoint.cc +1 -1
- data/src/core/ext/xds/xds_endpoint.h +3 -3
- data/src/core/ext/xds/xds_health_status.h +30 -3
- data/src/core/ext/xds/xds_http_fault_filter.h +3 -3
- data/src/core/ext/xds/xds_http_filters.cc +1 -1
- data/src/core/ext/xds/xds_http_filters.h +3 -3
- data/src/core/ext/xds/xds_http_rbac_filter.h +3 -3
- data/src/core/ext/xds/xds_http_stateful_session_filter.h +3 -3
- data/src/core/ext/xds/xds_lb_policy_registry.cc +95 -0
- data/src/core/ext/xds/xds_lb_policy_registry.h +3 -3
- data/src/core/ext/xds/xds_listener.cc +1 -0
- data/src/core/ext/xds/xds_listener.h +3 -3
- data/src/core/ext/xds/xds_resource_type.h +3 -3
- data/src/core/ext/xds/xds_resource_type_impl.h +3 -3
- data/src/core/ext/xds/xds_route_config.cc +6 -0
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_routing.h +3 -3
- data/src/core/ext/xds/xds_transport.h +3 -3
- data/src/core/ext/xds/xds_transport_grpc.h +3 -3
- data/src/core/lib/address_utils/parse_address.h +3 -3
- data/src/core/lib/address_utils/sockaddr_utils.cc +1 -0
- data/src/core/lib/address_utils/sockaddr_utils.h +3 -3
- data/src/core/lib/avl/avl.h +3 -3
- data/src/core/lib/backoff/backoff.h +3 -3
- data/src/core/lib/channel/call_finalization.h +3 -3
- data/src/core/lib/channel/call_tracer.h +3 -3
- data/src/core/lib/channel/channel_args.cc +1 -0
- data/src/core/lib/channel/channel_args.h +11 -5
- data/src/core/lib/channel/channel_args_preconditioning.h +3 -3
- data/src/core/lib/channel/channel_fwd.h +3 -3
- data/src/core/lib/channel/channel_stack.cc +1 -2
- data/src/core/lib/channel/channel_stack.h +4 -4
- data/src/core/lib/channel/channel_stack_builder.h +3 -3
- data/src/core/lib/channel/channel_stack_builder_impl.cc +14 -1
- data/src/core/lib/channel/channel_stack_builder_impl.h +3 -3
- data/src/core/lib/channel/channel_trace.h +3 -3
- data/src/core/lib/channel/channelz.h +3 -3
- data/src/core/lib/channel/channelz_registry.h +3 -3
- data/src/core/lib/channel/connected_channel.cc +883 -354
- data/src/core/lib/channel/connected_channel.h +3 -3
- data/src/core/lib/channel/context.h +7 -3
- data/src/core/lib/channel/promise_based_filter.cc +532 -260
- data/src/core/lib/channel/promise_based_filter.h +124 -44
- data/src/core/lib/channel/status_util.h +3 -3
- data/src/core/lib/compression/compression_internal.h +3 -3
- data/src/core/lib/compression/message_compress.h +3 -3
- data/src/core/lib/config/core_configuration.h +3 -3
- data/src/core/lib/debug/event_log.h +3 -3
- data/src/core/lib/debug/histogram_view.h +3 -3
- data/src/core/lib/debug/stats.h +3 -3
- data/src/core/lib/debug/stats_data.cc +66 -65
- data/src/core/lib/debug/stats_data.h +42 -33
- data/src/core/lib/debug/trace.h +4 -26
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +5 -0
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +3 -3
- data/src/core/lib/event_engine/common_closures.h +3 -3
- data/src/core/lib/event_engine/default_event_engine.cc +9 -4
- data/src/core/lib/event_engine/default_event_engine.h +30 -6
- data/src/core/lib/event_engine/default_event_engine_factory.h +3 -3
- data/src/core/lib/event_engine/event_engine.cc +25 -0
- data/src/core/lib/event_engine/executor/executor.h +3 -3
- data/src/core/lib/event_engine/forkable.cc +11 -6
- data/src/core/lib/event_engine/forkable.h +3 -3
- data/src/core/lib/event_engine/handle_containers.h +10 -3
- data/src/core/lib/event_engine/poller.h +3 -3
- data/src/core/lib/event_engine/posix.h +158 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +44 -16
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +14 -4
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +6 -7
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +3 -3
- data/src/core/lib/event_engine/posix_engine/event_poller.h +3 -3
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -3
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +3 -3
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +52 -55
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +46 -13
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +82 -12
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +23 -9
- data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +60 -7
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +65 -14
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +0 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +6 -6
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer_heap.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +3 -3
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +3 -3
- data/src/core/lib/event_engine/resolved_address.cc +19 -0
- data/src/core/lib/event_engine/resolved_address_internal.h +34 -0
- data/src/core/lib/event_engine/shim.cc +56 -0
- data/src/core/lib/event_engine/shim.h +33 -0
- data/src/core/lib/event_engine/slice.cc +1 -1
- data/src/core/lib/event_engine/tcp_socket_utils.cc +18 -2
- data/src/core/lib/event_engine/tcp_socket_utils.h +8 -3
- data/src/core/lib/event_engine/thread_local.cc +29 -0
- data/src/core/lib/event_engine/thread_local.h +32 -0
- data/src/core/lib/event_engine/thread_pool.cc +41 -65
- data/src/core/lib/event_engine/thread_pool.h +21 -17
- data/src/core/lib/event_engine/time_util.h +3 -3
- data/src/core/lib/event_engine/trace.cc +6 -0
- data/src/core/lib/event_engine/trace.h +16 -3
- data/src/core/lib/event_engine/utils.cc +2 -2
- data/src/core/lib/event_engine/utils.h +12 -4
- data/src/core/lib/event_engine/windows/iocp.cc +24 -40
- data/src/core/lib/event_engine/windows/iocp.h +3 -3
- data/src/core/lib/event_engine/windows/win_socket.cc +56 -33
- data/src/core/lib/event_engine/windows/win_socket.h +34 -25
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +331 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.h +103 -0
- data/src/core/lib/event_engine/windows/windows_engine.cc +243 -20
- data/src/core/lib/event_engine/windows/windows_engine.h +62 -23
- data/src/core/lib/experiments/config.cc +16 -1
- data/src/core/lib/experiments/config.h +13 -3
- data/src/core/lib/experiments/experiments.cc +14 -8
- data/src/core/lib/experiments/experiments.h +80 -21
- data/src/core/lib/gpr/alloc.h +3 -3
- data/src/core/lib/gpr/spinlock.h +3 -3
- data/src/core/lib/gpr/string.h +3 -3
- data/src/core/lib/gpr/sync_abseil.cc +15 -7
- data/src/core/lib/gpr/time_precise.h +3 -3
- data/src/core/lib/gpr/tmpfile.h +3 -3
- data/src/core/lib/gpr/useful.h +3 -3
- data/src/core/lib/gprpp/atomic_utils.h +3 -3
- data/src/core/lib/gprpp/bitset.h +3 -3
- data/src/core/lib/gprpp/chunked_vector.h +3 -3
- data/src/core/lib/gprpp/construct_destruct.h +3 -3
- data/src/core/lib/gprpp/cpp_impl_of.h +3 -3
- data/src/core/lib/gprpp/crash.h +3 -3
- data/src/core/lib/gprpp/debug_location.h +3 -6
- data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
- data/src/core/lib/gprpp/env.h +3 -3
- data/src/core/lib/gprpp/examine_stack.h +3 -3
- data/src/core/lib/gprpp/fork.cc +21 -4
- data/src/core/lib/gprpp/fork.h +7 -5
- data/src/core/lib/gprpp/global_config.h +3 -3
- data/src/core/lib/gprpp/global_config_custom.h +3 -3
- data/src/core/lib/gprpp/global_config_env.cc +1 -0
- data/src/core/lib/gprpp/global_config_env.h +3 -3
- data/src/core/lib/gprpp/global_config_generic.h +3 -3
- data/src/core/lib/gprpp/host_port.cc +2 -0
- data/src/core/lib/gprpp/host_port.h +3 -3
- data/src/core/lib/gprpp/load_file.h +3 -3
- data/src/core/lib/gprpp/manual_constructor.h +3 -3
- data/src/core/lib/gprpp/match.h +3 -3
- data/src/core/lib/gprpp/memory.h +3 -3
- data/src/core/lib/gprpp/mpscq.h +3 -3
- data/src/core/lib/gprpp/no_destruct.h +3 -3
- data/src/core/lib/gprpp/notification.h +3 -3
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/overload.h +3 -3
- data/src/core/lib/gprpp/packed_table.h +3 -3
- data/src/core/lib/gprpp/per_cpu.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +3 -3
- data/src/core/lib/gprpp/single_set_ptr.h +3 -3
- data/src/core/lib/gprpp/sorted_pack.h +3 -3
- data/src/core/lib/gprpp/stat.h +3 -3
- data/src/core/lib/gprpp/status_helper.h +3 -3
- data/src/core/lib/gprpp/strerror.cc +2 -0
- data/src/core/lib/gprpp/strerror.h +3 -3
- data/src/core/lib/gprpp/sync.h +3 -3
- data/src/core/lib/gprpp/table.h +3 -3
- data/src/core/lib/gprpp/tchar.h +3 -3
- data/src/core/lib/gprpp/thd.h +3 -3
- data/src/core/lib/gprpp/time.cc +1 -0
- data/src/core/lib/gprpp/time.h +3 -3
- data/src/core/lib/gprpp/time_averaged_stats.h +3 -3
- data/src/core/lib/gprpp/time_util.h +3 -3
- data/src/core/lib/gprpp/unique_type_name.h +3 -3
- data/src/core/lib/gprpp/validation_errors.h +3 -3
- data/src/core/lib/gprpp/work_serializer.h +3 -3
- data/src/core/lib/handshaker/proxy_mapper.h +3 -3
- data/src/core/lib/handshaker/proxy_mapper_registry.h +3 -3
- data/src/core/lib/http/format_request.cc +1 -0
- data/src/core/lib/http/format_request.h +3 -3
- data/src/core/lib/http/httpcli.cc +1 -0
- data/src/core/lib/http/httpcli.h +3 -3
- data/src/core/lib/http/httpcli_ssl_credentials.h +3 -3
- data/src/core/lib/http/parser.h +3 -3
- data/src/core/lib/iomgr/block_annotate.h +3 -3
- data/src/core/lib/iomgr/buffer_list.h +3 -3
- data/src/core/lib/iomgr/call_combiner.cc +4 -4
- data/src/core/lib/iomgr/call_combiner.h +3 -3
- data/src/core/lib/iomgr/cfstream_handle.h +3 -3
- data/src/core/lib/iomgr/closure.cc +27 -0
- data/src/core/lib/iomgr/closure.h +5 -3
- data/src/core/lib/iomgr/combiner.h +3 -3
- data/src/core/lib/iomgr/dynamic_annotations.h +3 -3
- data/src/core/lib/iomgr/endpoint.h +3 -3
- data/src/core/lib/iomgr/endpoint_cfstream.h +3 -3
- data/src/core/lib/iomgr/endpoint_pair.h +3 -3
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +10 -2
- data/src/core/lib/iomgr/error.h +3 -3
- data/src/core/lib/iomgr/error_cfstream.h +3 -3
- data/src/core/lib/iomgr/ev_apple.h +3 -3
- data/src/core/lib/iomgr/ev_epoll1_linux.h +3 -3
- data/src/core/lib/iomgr/ev_poll_posix.h +3 -3
- data/src/core/lib/iomgr/ev_posix.h +3 -3
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +62 -0
- data/src/core/lib/iomgr/event_engine_shims/closure.h +39 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +430 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +43 -0
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +91 -0
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.h +44 -0
- data/src/core/lib/iomgr/exec_ctx.h +3 -3
- data/src/core/lib/iomgr/executor.h +3 -3
- data/src/core/lib/iomgr/fork_posix.cc +5 -4
- data/src/core/lib/iomgr/gethostname.h +3 -3
- data/src/core/lib/iomgr/grpc_if_nametoindex.h +3 -3
- data/src/core/lib/iomgr/internal_errqueue.h +3 -3
- data/src/core/lib/iomgr/iocp_windows.h +3 -3
- data/src/core/lib/iomgr/iomgr.h +3 -3
- data/src/core/lib/iomgr/iomgr_fwd.h +3 -3
- data/src/core/lib/iomgr/iomgr_internal.h +3 -3
- data/src/core/lib/iomgr/load_file.h +3 -3
- data/src/core/lib/iomgr/lockfree_event.h +3 -3
- data/src/core/lib/iomgr/nameser.h +3 -3
- data/src/core/lib/iomgr/polling_entity.h +3 -3
- data/src/core/lib/iomgr/pollset.h +3 -3
- data/src/core/lib/iomgr/pollset_set.h +3 -3
- data/src/core/lib/iomgr/pollset_set_windows.h +3 -3
- data/src/core/lib/iomgr/pollset_windows.cc +2 -2
- data/src/core/lib/iomgr/pollset_windows.h +3 -3
- data/src/core/lib/iomgr/port.h +3 -3
- data/src/core/lib/iomgr/python_util.h +3 -3
- data/src/core/lib/iomgr/resolve_address.h +3 -3
- data/src/core/lib/iomgr/resolve_address_impl.h +3 -3
- data/src/core/lib/iomgr/resolve_address_posix.h +3 -3
- data/src/core/lib/iomgr/resolve_address_windows.h +3 -3
- data/src/core/lib/iomgr/resolved_address.h +3 -3
- data/src/core/lib/iomgr/sockaddr.h +3 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +3 -3
- data/src/core/lib/iomgr/sockaddr_windows.h +3 -3
- data/src/core/lib/iomgr/socket_factory_posix.h +3 -3
- data/src/core/lib/iomgr/socket_mutator.h +3 -3
- data/src/core/lib/iomgr/socket_utils.h +3 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -3
- data/src/core/lib/iomgr/socket_windows.h +3 -3
- data/src/core/lib/iomgr/systemd_utils.cc +19 -19
- data/src/core/lib/iomgr/systemd_utils.h +24 -24
- data/src/core/lib/iomgr/tcp_client.h +3 -3
- data/src/core/lib/iomgr/tcp_client_posix.cc +12 -0
- data/src/core/lib/iomgr/tcp_client_posix.h +3 -3
- data/src/core/lib/iomgr/tcp_client_windows.cc +13 -1
- data/src/core/lib/iomgr/tcp_posix.cc +49 -65
- data/src/core/lib/iomgr/tcp_posix.h +3 -3
- data/src/core/lib/iomgr/tcp_server.h +3 -3
- data/src/core/lib/iomgr/tcp_server_posix.cc +219 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +4 -6
- data/src/core/lib/iomgr/tcp_windows.h +3 -3
- data/src/core/lib/iomgr/timer.h +3 -3
- data/src/core/lib/iomgr/timer_generic.h +3 -3
- data/src/core/lib/iomgr/timer_heap.h +3 -3
- data/src/core/lib/iomgr/timer_manager.h +3 -3
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -3
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +3 -3
- data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -3
- data/src/core/lib/json/json.h +3 -3
- data/src/core/lib/json/json_args.h +3 -3
- data/src/core/lib/json/json_channel_args.h +3 -3
- data/src/core/lib/json/json_object_loader.h +3 -3
- data/src/core/lib/json/json_reader.cc +1 -0
- data/src/core/lib/json/json_util.h +3 -3
- data/src/core/lib/load_balancing/lb_policy.cc +9 -0
- data/src/core/lib/load_balancing/lb_policy.h +9 -5
- data/src/core/lib/load_balancing/lb_policy_factory.h +3 -3
- data/src/core/lib/load_balancing/lb_policy_registry.cc +1 -0
- data/src/core/lib/load_balancing/lb_policy_registry.h +3 -3
- data/src/core/lib/load_balancing/subchannel_interface.h +8 -6
- data/src/core/lib/matchers/matchers.cc +1 -0
- data/src/core/lib/matchers/matchers.h +3 -3
- data/src/core/lib/promise/activity.cc +8 -6
- data/src/core/lib/promise/activity.h +52 -66
- data/src/core/lib/promise/arena_promise.h +3 -3
- data/src/core/lib/promise/context.h +3 -3
- data/src/core/lib/promise/detail/basic_join.h +197 -0
- data/src/core/lib/promise/detail/basic_seq.h +10 -16
- data/src/core/lib/promise/detail/promise_factory.h +3 -3
- data/src/core/lib/promise/detail/promise_like.h +3 -3
- data/src/core/lib/promise/detail/status.h +3 -3
- data/src/core/lib/promise/detail/switch.h +3 -3
- data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +3 -3
- data/src/core/lib/promise/if.h +195 -0
- data/src/core/lib/promise/interceptor_list.h +308 -0
- data/src/core/lib/promise/intra_activity_waiter.h +9 -3
- data/src/core/lib/promise/latch.h +99 -5
- data/src/core/lib/promise/loop.h +4 -4
- data/src/core/lib/promise/map.h +4 -6
- data/src/core/lib/promise/pipe.h +296 -193
- data/src/core/lib/promise/poll.h +113 -14
- data/src/core/lib/promise/promise.h +4 -5
- data/src/core/lib/promise/race.h +6 -9
- data/src/core/lib/promise/seq.h +3 -3
- data/src/core/lib/promise/sleep.h +3 -3
- data/src/core/lib/promise/{pipe.cc → trace.cc} +3 -2
- data/src/core/lib/promise/trace.h +24 -0
- data/src/core/lib/promise/try_join.h +82 -0
- data/src/core/lib/promise/try_seq.h +3 -3
- data/src/core/lib/resolver/resolver.h +3 -3
- data/src/core/lib/resolver/resolver_factory.h +4 -4
- data/src/core/lib/resolver/resolver_registry.cc +15 -0
- data/src/core/lib/resolver/resolver_registry.h +3 -3
- data/src/core/lib/resolver/server_address.cc +1 -0
- data/src/core/lib/resolver/server_address.h +3 -3
- data/src/core/lib/resource_quota/api.h +3 -3
- data/src/core/lib/resource_quota/arena.cc +36 -9
- data/src/core/lib/resource_quota/arena.h +84 -22
- data/src/core/lib/resource_quota/memory_quota.h +3 -3
- data/src/core/lib/resource_quota/periodic_update.h +3 -3
- data/src/core/lib/resource_quota/resource_quota.h +3 -3
- data/src/core/lib/resource_quota/thread_quota.h +3 -3
- data/src/core/lib/resource_quota/trace.h +3 -3
- data/src/core/lib/security/authorization/authorization_engine.h +3 -3
- data/src/core/lib/security/authorization/authorization_policy_provider.h +3 -3
- data/src/core/lib/security/authorization/evaluate_args.h +3 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +3 -3
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +3 -3
- data/src/core/lib/security/authorization/matchers.h +3 -3
- data/src/core/lib/security/authorization/rbac_policy.cc +1 -0
- data/src/core/lib/security/authorization/rbac_policy.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +3 -3
- data/src/core/lib/security/context/security_context.h +3 -3
- data/src/core/lib/security/credentials/alts/alts_credentials.h +3 -3
- data/src/core/lib/security/credentials/alts/check_gcp_environment.h +3 -3
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +3 -3
- data/src/core/lib/security/credentials/call_creds_util.h +3 -3
- data/src/core/lib/security/credentials/channel_creds_registry.h +3 -3
- data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -3
- data/src/core/lib/security/credentials/credentials.h +3 -3
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.h +3 -3
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.h +3 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +3 -3
- data/src/core/lib/security/credentials/insecure/insecure_credentials.h +3 -3
- data/src/core/lib/security/credentials/jwt/json_token.h +3 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +4 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
- data/src/core/lib/security/credentials/local/local_credentials.h +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +4 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -3
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -3
- data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -3
- data/src/core/lib/security/credentials/tls/tls_utils.h +3 -3
- data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/load_system_roots.h +3 -3
- data/src/core/lib/security/security_connector/load_system_roots_supported.h +3 -3
- data/src/core/lib/security/security_connector/local/local_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl_utils.h +3 -3
- data/src/core/lib/security/security_connector/ssl_utils_config.h +3 -3
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +3 -3
- data/src/core/lib/security/transport/auth_filters.h +27 -5
- data/src/core/lib/security/transport/secure_endpoint.h +3 -3
- data/src/core/lib/security/transport/security_handshaker.cc +9 -0
- data/src/core/lib/security/transport/security_handshaker.h +3 -3
- data/src/core/lib/security/transport/server_auth_filter.cc +120 -251
- data/src/core/lib/security/transport/tsi_error.h +3 -3
- data/src/core/lib/security/util/json_util.h +3 -3
- data/src/core/lib/service_config/service_config.h +3 -3
- data/src/core/lib/service_config/service_config_call_data.h +3 -3
- data/src/core/lib/service_config/service_config_impl.h +3 -3
- data/src/core/lib/service_config/service_config_parser.h +3 -3
- data/src/core/lib/slice/b64.h +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +3 -3
- data/src/core/lib/slice/slice.h +14 -21
- data/src/core/lib/slice/slice_buffer.h +10 -4
- data/src/core/lib/slice/slice_internal.h +3 -3
- data/src/core/lib/slice/slice_refcount.cc +20 -0
- data/src/core/lib/slice/slice_refcount.h +26 -6
- data/src/core/lib/slice/slice_string_helpers.h +3 -3
- data/src/core/lib/surface/api_trace.h +3 -3
- data/src/core/lib/surface/builtins.h +3 -3
- data/src/core/lib/surface/call.cc +866 -252
- data/src/core/lib/surface/call.h +31 -3
- data/src/core/lib/surface/call_log_batch.cc +1 -0
- data/src/core/lib/surface/call_test_only.h +3 -3
- data/src/core/lib/surface/call_trace.cc +21 -11
- data/src/core/lib/surface/call_trace.h +3 -3
- data/src/core/lib/surface/channel.h +3 -3
- data/src/core/lib/surface/channel_init.h +3 -3
- data/src/core/lib/surface/channel_stack_type.h +3 -3
- data/src/core/lib/surface/completion_queue.cc +1 -0
- data/src/core/lib/surface/completion_queue.h +3 -3
- data/src/core/lib/surface/completion_queue_factory.h +3 -3
- data/src/core/lib/surface/event_string.cc +1 -0
- data/src/core/lib/surface/event_string.h +3 -3
- data/src/core/lib/surface/init.cc +1 -1
- data/src/core/lib/surface/init.h +3 -3
- data/src/core/lib/surface/init_internally.h +3 -3
- data/src/core/lib/surface/lame_client.cc +3 -1
- data/src/core/lib/surface/lame_client.h +3 -3
- data/src/core/lib/surface/server.cc +273 -27
- data/src/core/lib/surface/server.h +6 -3
- data/src/core/lib/surface/validate_metadata.h +3 -3
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +3 -3
- data/src/core/lib/transport/connectivity_state.h +3 -3
- data/src/core/lib/transport/error_utils.h +3 -3
- data/src/core/lib/transport/handshaker.cc +11 -0
- data/src/core/lib/transport/handshaker.h +4 -4
- data/src/core/lib/transport/handshaker_factory.h +3 -3
- data/src/core/lib/transport/handshaker_registry.h +3 -3
- data/src/core/lib/transport/http2_errors.h +3 -3
- data/src/core/lib/transport/http_connect_handshaker.h +3 -3
- data/src/core/lib/transport/metadata_batch.cc +11 -0
- data/src/core/lib/transport/metadata_batch.h +24 -3
- data/src/core/lib/transport/parsed_metadata.h +3 -3
- data/src/core/lib/transport/pid_controller.h +3 -3
- data/src/core/lib/transport/status_conversion.h +3 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +0 -1
- data/src/core/lib/transport/tcp_connect_handshaker.h +3 -3
- data/src/core/lib/transport/timeout_encoding.h +3 -3
- data/src/core/lib/transport/transport.cc +3 -8
- data/src/core/lib/transport/transport.h +16 -8
- data/src/core/lib/transport/transport_fwd.h +3 -3
- data/src/core/lib/transport/transport_impl.h +3 -3
- data/src/core/lib/transport/transport_op_string.cc +1 -0
- data/src/core/lib/uri/uri_parser.cc +1 -1
- data/src/core/lib/uri/uri_parser.h +3 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +5 -0
- data/src/core/tsi/alts/crypt/gsec.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_counter.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_crypter.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +3 -3
- data/src/core/tsi/alts/frame_protector/frame_handler.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +3 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +3 -3
- data/src/core/tsi/fake_transport_security.h +3 -3
- data/src/core/tsi/local_transport_security.h +3 -3
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +1 -1
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +3 -3
- data/src/core/tsi/ssl/session_cache/ssl_session.h +3 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -3
- data/src/core/tsi/ssl_transport_security.cc +113 -24
- data/src/core/tsi/ssl_transport_security.h +5 -3
- data/src/core/tsi/ssl_transport_security_utils.h +3 -3
- data/src/core/tsi/ssl_types.h +3 -3
- data/src/core/tsi/transport_security.h +3 -3
- data/src/core/tsi/transport_security_grpc.h +3 -3
- data/src/core/tsi/transport_security_interface.h +3 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +0 -6
- data/third_party/abseil-cpp/absl/algorithm/container.h +56 -57
- data/third_party/abseil-cpp/absl/base/attributes.h +39 -19
- data/third_party/abseil-cpp/absl/base/config.h +44 -3
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +3 -18
- data/third_party/abseil-cpp/absl/base/internal/cycleclock_config.h +55 -0
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -1
- data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +3 -3
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +1 -1
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +10 -6
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +23 -24
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +3 -3
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +2 -6
- data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +4 -1
- data/third_party/abseil-cpp/absl/base/internal/strerror.cc +4 -4
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +14 -10
- data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +9 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +4 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -40
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +62 -0
- data/third_party/abseil-cpp/absl/base/macros.h +4 -21
- data/third_party/abseil-cpp/absl/base/optimization.h +58 -6
- data/third_party/abseil-cpp/absl/base/options.h +1 -7
- data/third_party/abseil-cpp/absl/base/policy_checks.h +15 -13
- data/third_party/abseil-cpp/absl/container/fixed_array.h +7 -5
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -7
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +66 -18
- data/third_party/abseil-cpp/absl/container/internal/common.h +3 -3
- data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +132 -0
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +13 -1
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +4 -55
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +50 -5
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +14 -46
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +110 -32
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +155 -4
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +661 -341
- data/third_party/abseil-cpp/absl/crc/crc32c.cc +99 -0
- data/third_party/abseil-cpp/absl/crc/crc32c.h +183 -0
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +256 -0
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.h +57 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc.cc +468 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc.h +91 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +269 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc32c.h +39 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc32c_inline.h +72 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +130 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +159 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +179 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy.h +119 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_fallback.cc +75 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +434 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_non_temporal_memcpy.cc +93 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +725 -0
- data/third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +79 -0
- data/third_party/abseil-cpp/absl/crc/internal/non_temporal_memcpy.h +180 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +67 -38
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -13
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +11 -9
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +40 -85
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +5 -4
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +33 -8
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +3 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +3 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +118 -94
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +7 -6
- data/third_party/abseil-cpp/absl/functional/any_invocable.h +5 -2
- data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +47 -26
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +10 -10
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +18 -4
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +3 -14
- data/third_party/abseil-cpp/absl/memory/memory.h +26 -447
- data/third_party/abseil-cpp/absl/meta/type_traits.h +104 -12
- data/third_party/abseil-cpp/absl/numeric/bits.h +2 -3
- data/third_party/abseil-cpp/absl/numeric/int128.cc +10 -8
- data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +14 -6
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +2 -1
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +2 -23
- data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +9 -9
- data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +2 -2
- data/third_party/abseil-cpp/absl/random/random.h +6 -6
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +1 -0
- data/third_party/abseil-cpp/absl/status/status.cc +19 -12
- data/third_party/abseil-cpp/absl/status/status.h +2 -2
- data/third_party/abseil-cpp/absl/strings/ascii.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/charconv.cc +534 -96
- data/third_party/abseil-cpp/absl/strings/cord.cc +92 -40
- data/third_party/abseil-cpp/absl/strings/cord.h +71 -80
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +8 -5
- data/third_party/abseil-cpp/absl/strings/escaping.cc +73 -62
- data/third_party/abseil-cpp/absl/strings/escaping.h +24 -19
- data/third_party/abseil-cpp/absl/strings/internal/char_map.h +14 -12
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +4 -4
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +326 -70
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +8 -4
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +26 -14
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc +9 -7
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.h +5 -4
- data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +7 -15
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +3 -3
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +8 -5
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +7 -7
- data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +4 -4
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc +93 -0
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h +34 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +12 -10
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +7 -9
- data/third_party/abseil-cpp/absl/strings/internal/has_absl_stringify.h +55 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +9 -6
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +14 -7
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +35 -10
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +113 -46
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +126 -29
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +4 -3
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +49 -287
- data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +351 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +4 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +215 -181
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +10 -209
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +10 -101
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.cc +28 -0
- data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.h +57 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +34 -31
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +9 -6
- data/third_party/abseil-cpp/absl/strings/str_cat.h +50 -3
- data/third_party/abseil-cpp/absl/strings/str_format.h +71 -9
- data/third_party/abseil-cpp/absl/strings/string_view.cc +6 -6
- data/third_party/abseil-cpp/absl/strings/string_view.h +3 -10
- data/third_party/abseil-cpp/absl/strings/substitute.cc +8 -6
- data/third_party/abseil-cpp/absl/strings/substitute.h +46 -20
- data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +20 -17
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +37 -31
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +22 -8
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +104 -55
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +85 -46
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +0 -1
- data/third_party/abseil-cpp/absl/synchronization/notification.h +0 -1
- data/third_party/abseil-cpp/absl/time/civil_time.cc +26 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +25 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +17 -11
- data/third_party/abseil-cpp/absl/time/duration.cc +7 -7
- data/third_party/abseil-cpp/absl/time/format.cc +2 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +26 -5
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +7 -6
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +36 -35
- data/third_party/abseil-cpp/absl/time/time.cc +2 -2
- data/third_party/abseil-cpp/absl/time/time.h +253 -158
- data/third_party/abseil-cpp/absl/types/internal/span.h +30 -19
- data/third_party/abseil-cpp/absl/types/internal/variant.h +28 -40
- data/third_party/abseil-cpp/absl/types/span.h +29 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -2
- metadata +75 -10
- data/src/core/lib/event_engine/socket_notifier.h +0 -55
- data/src/core/lib/promise/for_each.h +0 -155
- data/src/core/lib/promise/map_pipe.h +0 -88
- data/src/core/lib/promise/try_concurrently.h +0 -342
data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc
ADDED
@@ -0,0 +1,972 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2022 gRPC authors.
|
3
|
+
//
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
// you may not use this file except in compliance with the License.
|
6
|
+
// You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
// See the License for the specific language governing permissions and
|
14
|
+
// limitations under the License.
|
15
|
+
//
|
16
|
+
|
17
|
+
#include <grpc/support/port_platform.h>
|
18
|
+
|
19
|
+
#include <inttypes.h>
|
20
|
+
#include <stdlib.h>
|
21
|
+
#include <string.h>
|
22
|
+
|
23
|
+
#include <algorithm>
|
24
|
+
#include <atomic>
|
25
|
+
#include <functional>
|
26
|
+
#include <map>
|
27
|
+
#include <memory>
|
28
|
+
#include <set>
|
29
|
+
#include <string>
|
30
|
+
#include <type_traits>
|
31
|
+
#include <utility>
|
32
|
+
#include <vector>
|
33
|
+
|
34
|
+
#include "absl/base/thread_annotations.h"
|
35
|
+
#include "absl/random/random.h"
|
36
|
+
#include "absl/status/status.h"
|
37
|
+
#include "absl/status/statusor.h"
|
38
|
+
#include "absl/strings/str_cat.h"
|
39
|
+
#include "absl/strings/str_join.h"
|
40
|
+
#include "absl/strings/string_view.h"
|
41
|
+
#include "absl/types/optional.h"
|
42
|
+
|
43
|
+
#include <grpc/event_engine/event_engine.h>
|
44
|
+
#include <grpc/impl/connectivity_state.h>
|
45
|
+
#include <grpc/support/log.h>
|
46
|
+
|
47
|
+
#include "src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h"
|
48
|
+
#include "src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h"
|
49
|
+
#include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
|
50
|
+
#include "src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h"
|
51
|
+
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
52
|
+
#include "src/core/lib/channel/channel_args.h"
|
53
|
+
#include "src/core/lib/config/core_configuration.h"
|
54
|
+
#include "src/core/lib/debug/trace.h"
|
55
|
+
#include "src/core/lib/gprpp/debug_location.h"
|
56
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
57
|
+
#include "src/core/lib/gprpp/ref_counted.h"
|
58
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
59
|
+
#include "src/core/lib/gprpp/sync.h"
|
60
|
+
#include "src/core/lib/gprpp/time.h"
|
61
|
+
#include "src/core/lib/gprpp/validation_errors.h"
|
62
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
63
|
+
#include "src/core/lib/iomgr/resolved_address.h"
|
64
|
+
#include "src/core/lib/json/json.h"
|
65
|
+
#include "src/core/lib/json/json_args.h"
|
66
|
+
#include "src/core/lib/json/json_object_loader.h"
|
67
|
+
#include "src/core/lib/load_balancing/lb_policy.h"
|
68
|
+
#include "src/core/lib/load_balancing/lb_policy_factory.h"
|
69
|
+
#include "src/core/lib/load_balancing/subchannel_interface.h"
|
70
|
+
#include "src/core/lib/resolver/server_address.h"
|
71
|
+
#include "src/core/lib/transport/connectivity_state.h"
|
72
|
+
|
73
|
+
namespace grpc_core {
|
74
|
+
|
75
|
+
TraceFlag grpc_lb_wrr_trace(false, "weighted_round_robin_lb");
|
76
|
+
|
77
|
+
namespace {
|
78
|
+
|
79
|
+
constexpr absl::string_view kWeightedRoundRobin =
|
80
|
+
"weighted_round_robin_experimental";
|
81
|
+
|
82
|
+
// Config for WRR policy.
|
83
|
+
class WeightedRoundRobinConfig : public LoadBalancingPolicy::Config {
|
84
|
+
public:
|
85
|
+
WeightedRoundRobinConfig() = default;
|
86
|
+
|
87
|
+
WeightedRoundRobinConfig(const WeightedRoundRobinConfig&) = delete;
|
88
|
+
WeightedRoundRobinConfig& operator=(const WeightedRoundRobinConfig&) = delete;
|
89
|
+
|
90
|
+
WeightedRoundRobinConfig(WeightedRoundRobinConfig&&) = delete;
|
91
|
+
WeightedRoundRobinConfig& operator=(WeightedRoundRobinConfig&&) = delete;
|
92
|
+
|
93
|
+
absl::string_view name() const override { return kWeightedRoundRobin; }
|
94
|
+
|
95
|
+
bool enable_oob_load_report() const { return enable_oob_load_report_; }
|
96
|
+
Duration oob_reporting_period() const { return oob_reporting_period_; }
|
97
|
+
Duration blackout_period() const { return blackout_period_; }
|
98
|
+
Duration weight_update_period() const { return weight_update_period_; }
|
99
|
+
Duration weight_expiration_period() const {
|
100
|
+
return weight_expiration_period_;
|
101
|
+
}
|
102
|
+
|
103
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&) {
|
104
|
+
static const auto* loader =
|
105
|
+
JsonObjectLoader<WeightedRoundRobinConfig>()
|
106
|
+
.OptionalField("enableOobLoadReport",
|
107
|
+
&WeightedRoundRobinConfig::enable_oob_load_report_)
|
108
|
+
.OptionalField("oobReportingPeriod",
|
109
|
+
&WeightedRoundRobinConfig::oob_reporting_period_)
|
110
|
+
.OptionalField("blackoutPeriod",
|
111
|
+
&WeightedRoundRobinConfig::blackout_period_)
|
112
|
+
.OptionalField("weightUpdatePeriod",
|
113
|
+
&WeightedRoundRobinConfig::weight_update_period_)
|
114
|
+
.OptionalField("weightExpirationPeriod",
|
115
|
+
&WeightedRoundRobinConfig::weight_expiration_period_)
|
116
|
+
.Finish();
|
117
|
+
return loader;
|
118
|
+
}
|
119
|
+
|
120
|
+
void JsonPostLoad(const Json&, const JsonArgs&, ValidationErrors*) {
|
121
|
+
// Impose lower bound of 100ms on weightUpdatePeriod.
|
122
|
+
weight_update_period_ =
|
123
|
+
std::max(weight_update_period_, Duration::Milliseconds(100));
|
124
|
+
}
|
125
|
+
|
126
|
+
private:
|
127
|
+
bool enable_oob_load_report_ = false;
|
128
|
+
Duration oob_reporting_period_ = Duration::Seconds(10);
|
129
|
+
Duration blackout_period_ = Duration::Seconds(10);
|
130
|
+
Duration weight_update_period_ = Duration::Seconds(1);
|
131
|
+
Duration weight_expiration_period_ = Duration::Minutes(3);
|
132
|
+
};
|
133
|
+
|
134
|
+
// WRR LB policy.
|
135
|
+
class WeightedRoundRobin : public LoadBalancingPolicy {
|
136
|
+
public:
|
137
|
+
explicit WeightedRoundRobin(Args args);
|
138
|
+
|
139
|
+
absl::string_view name() const override { return kWeightedRoundRobin; }
|
140
|
+
|
141
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
142
|
+
void ResetBackoffLocked() override;
|
143
|
+
|
144
|
+
private:
|
145
|
+
// Represents the weight for a given address.
|
146
|
+
class AddressWeight : public RefCounted<AddressWeight> {
|
147
|
+
public:
|
148
|
+
AddressWeight(RefCountedPtr<WeightedRoundRobin> wrr, std::string key)
|
149
|
+
: wrr_(std::move(wrr)), key_(std::move(key)) {}
|
150
|
+
~AddressWeight() override;
|
151
|
+
|
152
|
+
void MaybeUpdateWeight(double qps, double cpu_utilization);
|
153
|
+
|
154
|
+
float GetWeight(Timestamp now, Duration weight_expiration_period,
|
155
|
+
Duration blackout_period);
|
156
|
+
|
157
|
+
void ResetNonEmptySince();
|
158
|
+
|
159
|
+
private:
|
160
|
+
RefCountedPtr<WeightedRoundRobin> wrr_;
|
161
|
+
const std::string key_;
|
162
|
+
|
163
|
+
Mutex mu_;
|
164
|
+
float weight_ ABSL_GUARDED_BY(&mu_) = 0;
|
165
|
+
Timestamp non_empty_since_ ABSL_GUARDED_BY(&mu_) = Timestamp::InfFuture();
|
166
|
+
Timestamp last_update_time_ ABSL_GUARDED_BY(&mu_) = Timestamp::InfPast();
|
167
|
+
};
|
168
|
+
|
169
|
+
// Forward declaration.
|
170
|
+
class WeightedRoundRobinSubchannelList;
|
171
|
+
|
172
|
+
// Data for a particular subchannel in a subchannel list.
|
173
|
+
// This subclass adds the following functionality:
|
174
|
+
// - Tracks the previous connectivity state of the subchannel, so that
|
175
|
+
// we know how many subchannels are in each state.
|
176
|
+
class WeightedRoundRobinSubchannelData
|
177
|
+
: public SubchannelData<WeightedRoundRobinSubchannelList,
|
178
|
+
WeightedRoundRobinSubchannelData> {
|
179
|
+
public:
|
180
|
+
WeightedRoundRobinSubchannelData(
|
181
|
+
SubchannelList<WeightedRoundRobinSubchannelList,
|
182
|
+
WeightedRoundRobinSubchannelData>* subchannel_list,
|
183
|
+
const ServerAddress& address, RefCountedPtr<SubchannelInterface> sc);
|
184
|
+
|
185
|
+
absl::optional<grpc_connectivity_state> connectivity_state() const {
|
186
|
+
return logical_connectivity_state_;
|
187
|
+
}
|
188
|
+
|
189
|
+
RefCountedPtr<AddressWeight> weight() const { return weight_; }
|
190
|
+
|
191
|
+
private:
|
192
|
+
class OobWatcher : public OobBackendMetricWatcher {
|
193
|
+
public:
|
194
|
+
explicit OobWatcher(RefCountedPtr<AddressWeight> weight)
|
195
|
+
: weight_(std::move(weight)) {}
|
196
|
+
|
197
|
+
void OnBackendMetricReport(
|
198
|
+
const BackendMetricData& backend_metric_data) override;
|
199
|
+
|
200
|
+
private:
|
201
|
+
RefCountedPtr<AddressWeight> weight_;
|
202
|
+
};
|
203
|
+
|
204
|
+
// Performs connectivity state updates that need to be done only
|
205
|
+
// after we have started watching.
|
206
|
+
void ProcessConnectivityChangeLocked(
|
207
|
+
absl::optional<grpc_connectivity_state> old_state,
|
208
|
+
grpc_connectivity_state new_state) override;
|
209
|
+
|
210
|
+
// Updates the logical connectivity state.
|
211
|
+
void UpdateLogicalConnectivityStateLocked(
|
212
|
+
grpc_connectivity_state connectivity_state);
|
213
|
+
|
214
|
+
// The logical connectivity state of the subchannel.
|
215
|
+
// Note that the logical connectivity state may differ from the
|
216
|
+
// actual reported state in some cases (e.g., after we see
|
217
|
+
// TRANSIENT_FAILURE, we ignore any subsequent state changes until
|
218
|
+
// we see READY).
|
219
|
+
absl::optional<grpc_connectivity_state> logical_connectivity_state_;
|
220
|
+
|
221
|
+
RefCountedPtr<AddressWeight> weight_;
|
222
|
+
};
|
223
|
+
|
224
|
+
// A list of subchannels.
|
225
|
+
class WeightedRoundRobinSubchannelList
|
226
|
+
: public SubchannelList<WeightedRoundRobinSubchannelList,
|
227
|
+
WeightedRoundRobinSubchannelData> {
|
228
|
+
public:
|
229
|
+
WeightedRoundRobinSubchannelList(WeightedRoundRobin* policy,
|
230
|
+
ServerAddressList addresses,
|
231
|
+
const ChannelArgs& args)
|
232
|
+
: SubchannelList(policy,
|
233
|
+
(GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)
|
234
|
+
? "WeightedRoundRobinSubchannelList"
|
235
|
+
: nullptr),
|
236
|
+
std::move(addresses), policy->channel_control_helper(),
|
237
|
+
args) {
|
238
|
+
// Need to maintain a ref to the LB policy as long as we maintain
|
239
|
+
// any references to subchannels, since the subchannels'
|
240
|
+
// pollset_sets will include the LB policy's pollset_set.
|
241
|
+
policy->Ref(DEBUG_LOCATION, "subchannel_list").release();
|
242
|
+
}
|
243
|
+
|
244
|
+
~WeightedRoundRobinSubchannelList() override {
|
245
|
+
WeightedRoundRobin* p = static_cast<WeightedRoundRobin*>(policy());
|
246
|
+
p->Unref(DEBUG_LOCATION, "subchannel_list");
|
247
|
+
}
|
248
|
+
|
249
|
+
// Updates the counters of subchannels in each state when a
|
250
|
+
// subchannel transitions from old_state to new_state.
|
251
|
+
void UpdateStateCountersLocked(
|
252
|
+
absl::optional<grpc_connectivity_state> old_state,
|
253
|
+
grpc_connectivity_state new_state);
|
254
|
+
|
255
|
+
// Ensures that the right subchannel list is used and then updates
|
256
|
+
// the aggregated connectivity state based on the subchannel list's
|
257
|
+
// state counters.
|
258
|
+
void MaybeUpdateAggregatedConnectivityStateLocked(
|
259
|
+
absl::Status status_for_tf);
|
260
|
+
|
261
|
+
private:
|
262
|
+
std::string CountersString() const {
|
263
|
+
return absl::StrCat("num_subchannels=", num_subchannels(),
|
264
|
+
" num_ready=", num_ready_,
|
265
|
+
" num_connecting=", num_connecting_,
|
266
|
+
" num_transient_failure=", num_transient_failure_);
|
267
|
+
}
|
268
|
+
|
269
|
+
size_t num_ready_ = 0;
|
270
|
+
size_t num_connecting_ = 0;
|
271
|
+
size_t num_transient_failure_ = 0;
|
272
|
+
|
273
|
+
absl::Status last_failure_;
|
274
|
+
};
|
275
|
+
|
276
|
+
// A picker that performs WRR picks with weights based on
|
277
|
+
// endpoint-reported utilization and QPS.
|
278
|
+
class Picker : public SubchannelPicker {
|
279
|
+
public:
|
280
|
+
Picker(RefCountedPtr<WeightedRoundRobin> wrr,
|
281
|
+
WeightedRoundRobinSubchannelList* subchannel_list);
|
282
|
+
|
283
|
+
~Picker() override;
|
284
|
+
|
285
|
+
PickResult Pick(PickArgs args) override;
|
286
|
+
|
287
|
+
void Orphan() override;
|
288
|
+
|
289
|
+
private:
|
290
|
+
// A call tracker that collects per-call endpoint utilization reports.
|
291
|
+
class SubchannelCallTracker : public SubchannelCallTrackerInterface {
|
292
|
+
public:
|
293
|
+
explicit SubchannelCallTracker(RefCountedPtr<AddressWeight> weight)
|
294
|
+
: weight_(std::move(weight)) {}
|
295
|
+
|
296
|
+
void Start() override {}
|
297
|
+
|
298
|
+
void Finish(FinishArgs args) override;
|
299
|
+
|
300
|
+
private:
|
301
|
+
RefCountedPtr<AddressWeight> weight_;
|
302
|
+
};
|
303
|
+
|
304
|
+
// Info stored about each subchannel.
|
305
|
+
struct SubchannelInfo {
|
306
|
+
SubchannelInfo(RefCountedPtr<SubchannelInterface> subchannel,
|
307
|
+
RefCountedPtr<AddressWeight> weight)
|
308
|
+
: subchannel(std::move(subchannel)), weight(std::move(weight)) {}
|
309
|
+
|
310
|
+
RefCountedPtr<SubchannelInterface> subchannel;
|
311
|
+
RefCountedPtr<AddressWeight> weight;
|
312
|
+
};
|
313
|
+
|
314
|
+
// Returns the index into subchannels_ to be picked.
|
315
|
+
size_t PickIndex();
|
316
|
+
|
317
|
+
// Builds a new scheduler and swaps it into place, then starts a
|
318
|
+
// timer for the next update.
|
319
|
+
void BuildSchedulerAndStartTimerLocked()
|
320
|
+
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&timer_mu_);
|
321
|
+
|
322
|
+
RefCountedPtr<WeightedRoundRobin> wrr_;
|
323
|
+
const bool use_per_rpc_utilization_;
|
324
|
+
const Duration weight_update_period_;
|
325
|
+
const Duration weight_expiration_period_;
|
326
|
+
const Duration blackout_period_;
|
327
|
+
std::vector<SubchannelInfo> subchannels_;
|
328
|
+
|
329
|
+
Mutex scheduler_mu_;
|
330
|
+
std::shared_ptr<StaticStrideScheduler> scheduler_
|
331
|
+
ABSL_GUARDED_BY(&scheduler_mu_);
|
332
|
+
|
333
|
+
Mutex timer_mu_ ABSL_ACQUIRED_BEFORE(&scheduler_mu_);
|
334
|
+
absl::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>
|
335
|
+
timer_handle_ ABSL_GUARDED_BY(&timer_mu_);
|
336
|
+
|
337
|
+
// Used when falling back to RR.
|
338
|
+
std::atomic<size_t> last_picked_index_;
|
339
|
+
};
|
340
|
+
|
341
|
+
~WeightedRoundRobin() override;
|
342
|
+
|
343
|
+
void ShutdownLocked() override;
|
344
|
+
|
345
|
+
RefCountedPtr<AddressWeight> GetOrCreateWeight(
|
346
|
+
const grpc_resolved_address& address);
|
347
|
+
|
348
|
+
RefCountedPtr<WeightedRoundRobinConfig> config_;
|
349
|
+
|
350
|
+
// List of subchannels.
|
351
|
+
RefCountedPtr<WeightedRoundRobinSubchannelList> subchannel_list_;
|
352
|
+
// Latest pending subchannel list.
|
353
|
+
// When we get an updated address list, we create a new subchannel list
|
354
|
+
// for it here, and we wait to swap it into subchannel_list_ until the new
|
355
|
+
// list becomes READY.
|
356
|
+
RefCountedPtr<WeightedRoundRobinSubchannelList>
|
357
|
+
latest_pending_subchannel_list_;
|
358
|
+
|
359
|
+
Mutex address_weight_map_mu_;
|
360
|
+
std::map<std::string, AddressWeight*, std::less<>> address_weight_map_
|
361
|
+
ABSL_GUARDED_BY(&address_weight_map_mu_);
|
362
|
+
|
363
|
+
bool shutdown_ = false;
|
364
|
+
|
365
|
+
absl::BitGen bit_gen_;
|
366
|
+
|
367
|
+
// Accessed by picker.
|
368
|
+
std::atomic<uint32_t> scheduler_state_{absl::Uniform<uint32_t>(bit_gen_)};
|
369
|
+
};
|
370
|
+
|
371
|
+
//
|
372
|
+
// WeightedRoundRobin::AddressWeight
|
373
|
+
//
|
374
|
+
|
375
|
+
WeightedRoundRobin::AddressWeight::~AddressWeight() {
|
376
|
+
MutexLock lock(&wrr_->address_weight_map_mu_);
|
377
|
+
auto it = wrr_->address_weight_map_.find(key_);
|
378
|
+
if (it != wrr_->address_weight_map_.end() && it->second == this) {
|
379
|
+
wrr_->address_weight_map_.erase(it);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
void WeightedRoundRobin::AddressWeight::MaybeUpdateWeight(
|
384
|
+
double qps, double cpu_utilization) {
|
385
|
+
// Compute weight.
|
386
|
+
float weight = 0;
|
387
|
+
if (qps > 0 && cpu_utilization > 0) weight = qps / cpu_utilization;
|
388
|
+
if (weight == 0) {
|
389
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
390
|
+
gpr_log(GPR_INFO,
|
391
|
+
"[WRR %p] subchannel %s: qps=%f, cpu_utilization=%f: weight=%f "
|
392
|
+
"(not updating)",
|
393
|
+
wrr_.get(), key_.c_str(), qps, cpu_utilization, weight);
|
394
|
+
}
|
395
|
+
return;
|
396
|
+
}
|
397
|
+
Timestamp now = Timestamp::Now();
|
398
|
+
// Grab the lock and update the data.
|
399
|
+
MutexLock lock(&mu_);
|
400
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
401
|
+
gpr_log(GPR_INFO,
|
402
|
+
"[WRR %p] subchannel %s: qps=%f, cpu_utilization=%f: setting "
|
403
|
+
"weight=%f weight_=%f now=%s last_update_time_=%s "
|
404
|
+
"non_empty_since_=%s",
|
405
|
+
wrr_.get(), key_.c_str(), qps, cpu_utilization, weight, weight_,
|
406
|
+
now.ToString().c_str(), last_update_time_.ToString().c_str(),
|
407
|
+
non_empty_since_.ToString().c_str());
|
408
|
+
}
|
409
|
+
if (non_empty_since_ == Timestamp::InfFuture()) non_empty_since_ = now;
|
410
|
+
weight_ = weight;
|
411
|
+
last_update_time_ = now;
|
412
|
+
}
|
413
|
+
|
414
|
+
float WeightedRoundRobin::AddressWeight::GetWeight(
|
415
|
+
Timestamp now, Duration weight_expiration_period,
|
416
|
+
Duration blackout_period) {
|
417
|
+
MutexLock lock(&mu_);
|
418
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
419
|
+
gpr_log(GPR_INFO,
|
420
|
+
"[WRR %p] subchannel %s: getting weight: now=%s "
|
421
|
+
"weight_expiration_period=%s blackout_period=%s "
|
422
|
+
"last_update_time_=%s non_empty_since_=%s weight_=%f",
|
423
|
+
wrr_.get(), key_.c_str(), now.ToString().c_str(),
|
424
|
+
weight_expiration_period.ToString().c_str(),
|
425
|
+
blackout_period.ToString().c_str(),
|
426
|
+
last_update_time_.ToString().c_str(),
|
427
|
+
non_empty_since_.ToString().c_str(), weight_);
|
428
|
+
}
|
429
|
+
// If the most recent update was longer ago than the expiration
|
430
|
+
// period, reset non_empty_since_ so that we apply the blackout period
|
431
|
+
// again if we start getting data again in the future, and return 0.
|
432
|
+
if (now - last_update_time_ >= weight_expiration_period) {
|
433
|
+
non_empty_since_ = Timestamp::InfFuture();
|
434
|
+
return 0;
|
435
|
+
}
|
436
|
+
// If we don't have at least blackout_period worth of data, return 0.
|
437
|
+
if (blackout_period > Duration::Zero() &&
|
438
|
+
now - non_empty_since_ < blackout_period) {
|
439
|
+
return 0;
|
440
|
+
}
|
441
|
+
// Otherwise, return the weight.
|
442
|
+
return weight_;
|
443
|
+
}
|
444
|
+
|
445
|
+
void WeightedRoundRobin::AddressWeight::ResetNonEmptySince() {
|
446
|
+
MutexLock lock(&mu_);
|
447
|
+
non_empty_since_ = Timestamp::InfFuture();
|
448
|
+
}
|
449
|
+
|
450
|
+
//
|
451
|
+
// WeightedRoundRobin::Picker::SubchannelCallTracker
|
452
|
+
//
|
453
|
+
|
454
|
+
void WeightedRoundRobin::Picker::SubchannelCallTracker::Finish(
|
455
|
+
FinishArgs args) {
|
456
|
+
auto* backend_metric_data =
|
457
|
+
args.backend_metric_accessor->GetBackendMetricData();
|
458
|
+
double qps = 0;
|
459
|
+
double cpu_utilization = 0;
|
460
|
+
if (backend_metric_data != nullptr) {
|
461
|
+
qps = backend_metric_data->qps;
|
462
|
+
cpu_utilization = backend_metric_data->cpu_utilization;
|
463
|
+
}
|
464
|
+
weight_->MaybeUpdateWeight(qps, cpu_utilization);
|
465
|
+
}
|
466
|
+
|
467
|
+
//
|
468
|
+
// WeightedRoundRobin::Picker
|
469
|
+
//
|
470
|
+
|
471
|
+
WeightedRoundRobin::Picker::Picker(
|
472
|
+
RefCountedPtr<WeightedRoundRobin> wrr,
|
473
|
+
WeightedRoundRobinSubchannelList* subchannel_list)
|
474
|
+
: wrr_(std::move(wrr)),
|
475
|
+
use_per_rpc_utilization_(!wrr_->config_->enable_oob_load_report()),
|
476
|
+
weight_update_period_(wrr_->config_->weight_update_period()),
|
477
|
+
weight_expiration_period_(wrr_->config_->weight_expiration_period()),
|
478
|
+
blackout_period_(wrr_->config_->blackout_period()),
|
479
|
+
last_picked_index_(absl::Uniform<size_t>(wrr_->bit_gen_)) {
|
480
|
+
for (size_t i = 0; i < subchannel_list->num_subchannels(); ++i) {
|
481
|
+
WeightedRoundRobinSubchannelData* sd = subchannel_list->subchannel(i);
|
482
|
+
if (sd->connectivity_state() == GRPC_CHANNEL_READY) {
|
483
|
+
subchannels_.emplace_back(sd->subchannel()->Ref(), sd->weight());
|
484
|
+
}
|
485
|
+
}
|
486
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
487
|
+
gpr_log(GPR_INFO,
|
488
|
+
"[WRR %p picker %p] created picker from subchannel_list=%p "
|
489
|
+
"with %" PRIuPTR " subchannels",
|
490
|
+
wrr_.get(), this, subchannel_list, subchannels_.size());
|
491
|
+
}
|
492
|
+
BuildSchedulerAndStartTimerLocked();
|
493
|
+
}
|
494
|
+
|
495
|
+
WeightedRoundRobin::Picker::~Picker() {
|
496
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
497
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] destroying picker", wrr_.get(), this);
|
498
|
+
}
|
499
|
+
}
|
500
|
+
|
501
|
+
void WeightedRoundRobin::Picker::Orphan() {
|
502
|
+
MutexLock lock(&timer_mu_);
|
503
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
504
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] cancelling timer", wrr_.get(), this);
|
505
|
+
}
|
506
|
+
wrr_->channel_control_helper()->GetEventEngine()->Cancel(*timer_handle_);
|
507
|
+
timer_handle_.reset();
|
508
|
+
}
|
509
|
+
|
510
|
+
WeightedRoundRobin::PickResult WeightedRoundRobin::Picker::Pick(
|
511
|
+
PickArgs /*args*/) {
|
512
|
+
size_t index = PickIndex();
|
513
|
+
GPR_ASSERT(index < subchannels_.size());
|
514
|
+
auto& subchannel_info = subchannels_[index];
|
515
|
+
// Collect per-call utilization data if needed.
|
516
|
+
std::unique_ptr<SubchannelCallTrackerInterface> subchannel_call_tracker;
|
517
|
+
if (use_per_rpc_utilization_) {
|
518
|
+
subchannel_call_tracker =
|
519
|
+
std::make_unique<SubchannelCallTracker>(subchannel_info.weight);
|
520
|
+
}
|
521
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
522
|
+
gpr_log(GPR_INFO,
|
523
|
+
"[WRR %p picker %p] returning index %" PRIuPTR ", subchannel=%p",
|
524
|
+
wrr_.get(), this, index, subchannel_info.subchannel.get());
|
525
|
+
}
|
526
|
+
return PickResult::Complete(subchannel_info.subchannel,
|
527
|
+
std::move(subchannel_call_tracker));
|
528
|
+
}
|
529
|
+
|
530
|
+
size_t WeightedRoundRobin::Picker::PickIndex() {
|
531
|
+
// Grab a ref to the scheduler.
|
532
|
+
std::shared_ptr<StaticStrideScheduler> scheduler;
|
533
|
+
{
|
534
|
+
MutexLock lock(&scheduler_mu_);
|
535
|
+
scheduler = scheduler_;
|
536
|
+
}
|
537
|
+
// If we have a scheduler, use it to do a WRR pick.
|
538
|
+
if (scheduler != nullptr) return scheduler->Pick();
|
539
|
+
// We don't have a scheduler (i.e., either all of the weights are 0 or
|
540
|
+
// there is only one subchannel), so fall back to RR.
|
541
|
+
return last_picked_index_.fetch_add(1) % subchannels_.size();
|
542
|
+
}
|
543
|
+
|
544
|
+
void WeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
545
|
+
// Build scheduler.
|
546
|
+
const Timestamp now = Timestamp::Now();
|
547
|
+
std::vector<float> weights;
|
548
|
+
weights.reserve(subchannels_.size());
|
549
|
+
for (const auto& subchannel : subchannels_) {
|
550
|
+
weights.push_back(subchannel.weight->GetWeight(
|
551
|
+
now, weight_expiration_period_, blackout_period_));
|
552
|
+
}
|
553
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
554
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] new weights: %s", wrr_.get(), this,
|
555
|
+
absl::StrJoin(weights, " ").c_str());
|
556
|
+
}
|
557
|
+
auto scheduler_or = StaticStrideScheduler::Make(
|
558
|
+
weights, [this]() { return wrr_->scheduler_state_.fetch_add(1); });
|
559
|
+
std::shared_ptr<StaticStrideScheduler> scheduler;
|
560
|
+
if (scheduler_or.has_value()) {
|
561
|
+
scheduler =
|
562
|
+
std::make_shared<StaticStrideScheduler>(std::move(*scheduler_or));
|
563
|
+
}
|
564
|
+
{
|
565
|
+
MutexLock lock(&scheduler_mu_);
|
566
|
+
scheduler_ = std::move(scheduler);
|
567
|
+
}
|
568
|
+
// Start timer.
|
569
|
+
WeakRefCountedPtr<Picker> self = WeakRef();
|
570
|
+
timer_handle_ = wrr_->channel_control_helper()->GetEventEngine()->RunAfter(
|
571
|
+
weight_update_period_, [self = std::move(self)]() mutable {
|
572
|
+
ApplicationCallbackExecCtx callback_exec_ctx;
|
573
|
+
ExecCtx exec_ctx;
|
574
|
+
{
|
575
|
+
MutexLock lock(&self->timer_mu_);
|
576
|
+
if (self->timer_handle_.has_value()) {
|
577
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
578
|
+
gpr_log(GPR_INFO, "[WRR %p picker %p] timer fired",
|
579
|
+
self->wrr_.get(), self.get());
|
580
|
+
}
|
581
|
+
self->BuildSchedulerAndStartTimerLocked();
|
582
|
+
}
|
583
|
+
}
|
584
|
+
// Release ref before ExecCtx goes out of scope.
|
585
|
+
self.reset();
|
586
|
+
});
|
587
|
+
}
|
588
|
+
|
589
|
+
//
|
590
|
+
// WeightedRoundRobin
|
591
|
+
//
|
592
|
+
|
593
|
+
WeightedRoundRobin::WeightedRoundRobin(Args args)
|
594
|
+
: LoadBalancingPolicy(std::move(args)) {
|
595
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
596
|
+
gpr_log(GPR_INFO, "[WRR %p] Created", this);
|
597
|
+
}
|
598
|
+
}
|
599
|
+
|
600
|
+
WeightedRoundRobin::~WeightedRoundRobin() {
|
601
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
602
|
+
gpr_log(GPR_INFO, "[WRR %p] Destroying Round Robin policy", this);
|
603
|
+
}
|
604
|
+
GPR_ASSERT(subchannel_list_ == nullptr);
|
605
|
+
GPR_ASSERT(latest_pending_subchannel_list_ == nullptr);
|
606
|
+
}
|
607
|
+
|
608
|
+
void WeightedRoundRobin::ShutdownLocked() {
|
609
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
610
|
+
gpr_log(GPR_INFO, "[WRR %p] Shutting down", this);
|
611
|
+
}
|
612
|
+
shutdown_ = true;
|
613
|
+
subchannel_list_.reset();
|
614
|
+
latest_pending_subchannel_list_.reset();
|
615
|
+
}
|
616
|
+
|
617
|
+
void WeightedRoundRobin::ResetBackoffLocked() {
|
618
|
+
subchannel_list_->ResetBackoffLocked();
|
619
|
+
if (latest_pending_subchannel_list_ != nullptr) {
|
620
|
+
latest_pending_subchannel_list_->ResetBackoffLocked();
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
absl::Status WeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
625
|
+
config_ = std::move(args.config);
|
626
|
+
ServerAddressList addresses;
|
627
|
+
if (args.addresses.ok()) {
|
628
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
629
|
+
gpr_log(GPR_INFO, "[WRR %p] received update with %" PRIuPTR " addresses",
|
630
|
+
this, args.addresses->size());
|
631
|
+
}
|
632
|
+
// Weed out duplicate addresses. Also sort the addresses so that if
|
633
|
+
// the set of the addresses don't change, their indexes in the
|
634
|
+
// subchannel list don't change, since this avoids unnecessary churn
|
635
|
+
// in the picker. Note that this does not ensure that if a given
|
636
|
+
// address remains present that it will have the same index; if,
|
637
|
+
// for example, an address at the end of the list is replaced with one
|
638
|
+
// that sorts much earlier in the list, then all of the addresses in
|
639
|
+
// between those two positions will have changed indexes.
|
640
|
+
struct AddressLessThan {
|
641
|
+
bool operator()(const ServerAddress& address1,
|
642
|
+
const ServerAddress& address2) const {
|
643
|
+
const grpc_resolved_address& addr1 = address1.address();
|
644
|
+
const grpc_resolved_address& addr2 = address2.address();
|
645
|
+
if (addr1.len != addr2.len) return addr1.len < addr2.len;
|
646
|
+
return memcmp(addr1.addr, addr2.addr, addr1.len) < 0;
|
647
|
+
}
|
648
|
+
};
|
649
|
+
std::set<ServerAddress, AddressLessThan> ordered_addresses(
|
650
|
+
args.addresses->begin(), args.addresses->end());
|
651
|
+
addresses =
|
652
|
+
ServerAddressList(ordered_addresses.begin(), ordered_addresses.end());
|
653
|
+
} else {
|
654
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
655
|
+
gpr_log(GPR_INFO, "[WRR %p] received update with address error: %s", this,
|
656
|
+
args.addresses.status().ToString().c_str());
|
657
|
+
}
|
658
|
+
// If we already have a subchannel list, then keep using the existing
|
659
|
+
// list, but still report back that the update was not accepted.
|
660
|
+
if (subchannel_list_ != nullptr) return args.addresses.status();
|
661
|
+
}
|
662
|
+
// Create new subchannel list, replacing the previous pending list, if any.
|
663
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace) &&
|
664
|
+
latest_pending_subchannel_list_ != nullptr) {
|
665
|
+
gpr_log(GPR_INFO, "[WRR %p] replacing previous pending subchannel list %p",
|
666
|
+
this, latest_pending_subchannel_list_.get());
|
667
|
+
}
|
668
|
+
latest_pending_subchannel_list_ =
|
669
|
+
MakeRefCounted<WeightedRoundRobinSubchannelList>(
|
670
|
+
this, std::move(addresses), args.args);
|
671
|
+
latest_pending_subchannel_list_->StartWatchingLocked();
|
672
|
+
// If the new list is empty, immediately promote it to
|
673
|
+
// subchannel_list_ and report TRANSIENT_FAILURE.
|
674
|
+
if (latest_pending_subchannel_list_->num_subchannels() == 0) {
|
675
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace) &&
|
676
|
+
subchannel_list_ != nullptr) {
|
677
|
+
gpr_log(GPR_INFO, "[WRR %p] replacing previous subchannel list %p", this,
|
678
|
+
subchannel_list_.get());
|
679
|
+
}
|
680
|
+
subchannel_list_ = std::move(latest_pending_subchannel_list_);
|
681
|
+
absl::Status status =
|
682
|
+
args.addresses.ok() ? absl::UnavailableError(absl::StrCat(
|
683
|
+
"empty address list: ", args.resolution_note))
|
684
|
+
: args.addresses.status();
|
685
|
+
channel_control_helper()->UpdateState(
|
686
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
687
|
+
MakeRefCounted<TransientFailurePicker>(status));
|
688
|
+
return status;
|
689
|
+
}
|
690
|
+
// Otherwise, if this is the initial update, immediately promote it to
|
691
|
+
// subchannel_list_ and report CONNECTING.
|
692
|
+
if (subchannel_list_.get() == nullptr) {
|
693
|
+
subchannel_list_ = std::move(latest_pending_subchannel_list_);
|
694
|
+
channel_control_helper()->UpdateState(
|
695
|
+
GRPC_CHANNEL_CONNECTING, absl::Status(),
|
696
|
+
MakeRefCounted<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker")));
|
697
|
+
}
|
698
|
+
return absl::OkStatus();
|
699
|
+
}
|
700
|
+
|
701
|
+
RefCountedPtr<WeightedRoundRobin::AddressWeight>
|
702
|
+
WeightedRoundRobin::GetOrCreateWeight(const grpc_resolved_address& address) {
|
703
|
+
auto key = grpc_sockaddr_to_uri(&address);
|
704
|
+
if (!key.ok()) return nullptr;
|
705
|
+
MutexLock lock(&address_weight_map_mu_);
|
706
|
+
auto it = address_weight_map_.find(*key);
|
707
|
+
if (it != address_weight_map_.end()) {
|
708
|
+
auto weight = it->second->RefIfNonZero();
|
709
|
+
if (weight != nullptr) return weight;
|
710
|
+
}
|
711
|
+
auto weight =
|
712
|
+
MakeRefCounted<AddressWeight>(Ref(DEBUG_LOCATION, "AddressWeight"), *key);
|
713
|
+
address_weight_map_.emplace(*key, weight.get());
|
714
|
+
return weight;
|
715
|
+
}
|
716
|
+
|
717
|
+
//
|
718
|
+
// WeightedRoundRobin::WeightedRoundRobinSubchannelList
|
719
|
+
//
|
720
|
+
|
721
|
+
void WeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
722
|
+
UpdateStateCountersLocked(absl::optional<grpc_connectivity_state> old_state,
|
723
|
+
grpc_connectivity_state new_state) {
|
724
|
+
if (old_state.has_value()) {
|
725
|
+
GPR_ASSERT(*old_state != GRPC_CHANNEL_SHUTDOWN);
|
726
|
+
if (*old_state == GRPC_CHANNEL_READY) {
|
727
|
+
GPR_ASSERT(num_ready_ > 0);
|
728
|
+
--num_ready_;
|
729
|
+
} else if (*old_state == GRPC_CHANNEL_CONNECTING) {
|
730
|
+
GPR_ASSERT(num_connecting_ > 0);
|
731
|
+
--num_connecting_;
|
732
|
+
} else if (*old_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
733
|
+
GPR_ASSERT(num_transient_failure_ > 0);
|
734
|
+
--num_transient_failure_;
|
735
|
+
}
|
736
|
+
}
|
737
|
+
GPR_ASSERT(new_state != GRPC_CHANNEL_SHUTDOWN);
|
738
|
+
if (new_state == GRPC_CHANNEL_READY) {
|
739
|
+
++num_ready_;
|
740
|
+
} else if (new_state == GRPC_CHANNEL_CONNECTING) {
|
741
|
+
++num_connecting_;
|
742
|
+
} else if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
743
|
+
++num_transient_failure_;
|
744
|
+
}
|
745
|
+
}
|
746
|
+
|
747
|
+
void WeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
748
|
+
MaybeUpdateAggregatedConnectivityStateLocked(absl::Status status_for_tf) {
|
749
|
+
WeightedRoundRobin* p = static_cast<WeightedRoundRobin*>(policy());
|
750
|
+
// If this is latest_pending_subchannel_list_, then swap it into
|
751
|
+
// subchannel_list_ in the following cases:
|
752
|
+
// - subchannel_list_ has no READY subchannels.
|
753
|
+
// - This list has at least one READY subchannel and we have seen the
|
754
|
+
// initial connectivity state notification for all subchannels.
|
755
|
+
// - All of the subchannels in this list are in TRANSIENT_FAILURE.
|
756
|
+
// (This may cause the channel to go from READY to TRANSIENT_FAILURE,
|
757
|
+
// but we're doing what the control plane told us to do.)
|
758
|
+
if (p->latest_pending_subchannel_list_.get() == this &&
|
759
|
+
(p->subchannel_list_->num_ready_ == 0 ||
|
760
|
+
(num_ready_ > 0 && AllSubchannelsSeenInitialState()) ||
|
761
|
+
num_transient_failure_ == num_subchannels())) {
|
762
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
763
|
+
const std::string old_counters_string =
|
764
|
+
p->subchannel_list_ != nullptr ? p->subchannel_list_->CountersString()
|
765
|
+
: "";
|
766
|
+
gpr_log(
|
767
|
+
GPR_INFO,
|
768
|
+
"[WRR %p] swapping out subchannel list %p (%s) in favor of %p (%s)",
|
769
|
+
p, p->subchannel_list_.get(), old_counters_string.c_str(), this,
|
770
|
+
CountersString().c_str());
|
771
|
+
}
|
772
|
+
p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
|
773
|
+
}
|
774
|
+
// Only set connectivity state if this is the current subchannel list.
|
775
|
+
if (p->subchannel_list_.get() != this) return;
|
776
|
+
// First matching rule wins:
|
777
|
+
// 1) ANY subchannel is READY => policy is READY.
|
778
|
+
// 2) ANY subchannel is CONNECTING => policy is CONNECTING.
|
779
|
+
// 3) ALL subchannels are TRANSIENT_FAILURE => policy is TRANSIENT_FAILURE.
|
780
|
+
if (num_ready_ > 0) {
|
781
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
782
|
+
gpr_log(GPR_INFO, "[WRR %p] reporting READY with subchannel list %p", p,
|
783
|
+
this);
|
784
|
+
}
|
785
|
+
p->channel_control_helper()->UpdateState(
|
786
|
+
GRPC_CHANNEL_READY, absl::Status(),
|
787
|
+
MakeRefCounted<Picker>(p->Ref(), this));
|
788
|
+
} else if (num_connecting_ > 0) {
|
789
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
790
|
+
gpr_log(GPR_INFO, "[WRR %p] reporting CONNECTING with subchannel list %p",
|
791
|
+
p, this);
|
792
|
+
}
|
793
|
+
p->channel_control_helper()->UpdateState(
|
794
|
+
GRPC_CHANNEL_CONNECTING, absl::Status(),
|
795
|
+
MakeRefCounted<QueuePicker>(p->Ref(DEBUG_LOCATION, "QueuePicker")));
|
796
|
+
} else if (num_transient_failure_ == num_subchannels()) {
|
797
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
798
|
+
gpr_log(
|
799
|
+
GPR_INFO,
|
800
|
+
"[WRR %p] reporting TRANSIENT_FAILURE with subchannel list %p: %s", p,
|
801
|
+
this, status_for_tf.ToString().c_str());
|
802
|
+
}
|
803
|
+
if (!status_for_tf.ok()) {
|
804
|
+
last_failure_ = absl::UnavailableError(
|
805
|
+
absl::StrCat("connections to all backends failing; last error: ",
|
806
|
+
status_for_tf.ToString()));
|
807
|
+
}
|
808
|
+
p->channel_control_helper()->UpdateState(
|
809
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE, last_failure_,
|
810
|
+
MakeRefCounted<TransientFailurePicker>(last_failure_));
|
811
|
+
}
|
812
|
+
}
|
813
|
+
|
814
|
+
//
|
815
|
+
// WeightedRoundRobin::WeightedRoundRobinSubchannelData::OobWatcher
|
816
|
+
//
|
817
|
+
|
818
|
+
void WeightedRoundRobin::WeightedRoundRobinSubchannelData::OobWatcher::
|
819
|
+
OnBackendMetricReport(const BackendMetricData& backend_metric_data) {
|
820
|
+
weight_->MaybeUpdateWeight(backend_metric_data.qps,
|
821
|
+
backend_metric_data.cpu_utilization);
|
822
|
+
}
|
823
|
+
|
824
|
+
//
|
825
|
+
// WeightedRoundRobin::WeightedRoundRobinSubchannelData
|
826
|
+
//
|
827
|
+
|
828
|
+
WeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
829
|
+
WeightedRoundRobinSubchannelData(
|
830
|
+
SubchannelList<WeightedRoundRobinSubchannelList,
|
831
|
+
WeightedRoundRobinSubchannelData>* subchannel_list,
|
832
|
+
const ServerAddress& address, RefCountedPtr<SubchannelInterface> sc)
|
833
|
+
: SubchannelData(subchannel_list, address, std::move(sc)),
|
834
|
+
weight_(static_cast<WeightedRoundRobin*>(subchannel_list->policy())
|
835
|
+
->GetOrCreateWeight(address.address())) {
|
836
|
+
// Start OOB watch if configured.
|
837
|
+
WeightedRoundRobin* p =
|
838
|
+
static_cast<WeightedRoundRobin*>(subchannel_list->policy());
|
839
|
+
if (p->config_->enable_oob_load_report()) {
|
840
|
+
subchannel()->AddDataWatcher(
|
841
|
+
MakeOobBackendMetricWatcher(p->config_->oob_reporting_period(),
|
842
|
+
std::make_unique<OobWatcher>(weight_)));
|
843
|
+
}
|
844
|
+
}
|
845
|
+
|
846
|
+
void WeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
847
|
+
ProcessConnectivityChangeLocked(
|
848
|
+
absl::optional<grpc_connectivity_state> old_state,
|
849
|
+
grpc_connectivity_state new_state) {
|
850
|
+
WeightedRoundRobin* p =
|
851
|
+
static_cast<WeightedRoundRobin*>(subchannel_list()->policy());
|
852
|
+
GPR_ASSERT(subchannel() != nullptr);
|
853
|
+
// If this is not the initial state notification and the new state is
|
854
|
+
// TRANSIENT_FAILURE or IDLE, re-resolve.
|
855
|
+
// Note that we don't want to do this on the initial state notification,
|
856
|
+
// because that would result in an endless loop of re-resolution.
|
857
|
+
if (old_state.has_value() && (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
|
858
|
+
new_state == GRPC_CHANNEL_IDLE)) {
|
859
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
860
|
+
gpr_log(GPR_INFO,
|
861
|
+
"[WRR %p] Subchannel %p reported %s; requesting re-resolution", p,
|
862
|
+
subchannel(), ConnectivityStateName(new_state));
|
863
|
+
}
|
864
|
+
p->channel_control_helper()->RequestReresolution();
|
865
|
+
}
|
866
|
+
if (new_state == GRPC_CHANNEL_IDLE) {
|
867
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
868
|
+
gpr_log(GPR_INFO,
|
869
|
+
"[WRR %p] Subchannel %p reported IDLE; requesting connection", p,
|
870
|
+
subchannel());
|
871
|
+
}
|
872
|
+
subchannel()->RequestConnection();
|
873
|
+
} else if (new_state == GRPC_CHANNEL_READY) {
|
874
|
+
// If we transition back to READY state, restart the blackout period.
|
875
|
+
// Note that we cannot guarantee that we will never receive
|
876
|
+
// lingering callbacks for backend metric reports from the previous
|
877
|
+
// connection after the new connection has been established, but they
|
878
|
+
// should be masked by new backend metric reports from the new
|
879
|
+
// connection by the time the blackout period ends.
|
880
|
+
weight_->ResetNonEmptySince();
|
881
|
+
}
|
882
|
+
// Update logical connectivity state.
|
883
|
+
UpdateLogicalConnectivityStateLocked(new_state);
|
884
|
+
// Update the policy state.
|
885
|
+
subchannel_list()->MaybeUpdateAggregatedConnectivityStateLocked(
|
886
|
+
connectivity_status());
|
887
|
+
}
|
888
|
+
|
889
|
+
void WeightedRoundRobin::WeightedRoundRobinSubchannelData::
|
890
|
+
UpdateLogicalConnectivityStateLocked(
|
891
|
+
grpc_connectivity_state connectivity_state) {
|
892
|
+
WeightedRoundRobin* p =
|
893
|
+
static_cast<WeightedRoundRobin*>(subchannel_list()->policy());
|
894
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
895
|
+
gpr_log(
|
896
|
+
GPR_INFO,
|
897
|
+
"[WRR %p] connectivity changed for subchannel %p, subchannel_list %p "
|
898
|
+
"(index %" PRIuPTR " of %" PRIuPTR "): prev_state=%s new_state=%s",
|
899
|
+
p, subchannel(), subchannel_list(), Index(),
|
900
|
+
subchannel_list()->num_subchannels(),
|
901
|
+
(logical_connectivity_state_.has_value()
|
902
|
+
? ConnectivityStateName(*logical_connectivity_state_)
|
903
|
+
: "N/A"),
|
904
|
+
ConnectivityStateName(connectivity_state));
|
905
|
+
}
|
906
|
+
// Decide what state to report for aggregation purposes.
|
907
|
+
// If the last logical state was TRANSIENT_FAILURE, then ignore the
|
908
|
+
// state change unless the new state is READY.
|
909
|
+
if (logical_connectivity_state_.has_value() &&
|
910
|
+
*logical_connectivity_state_ == GRPC_CHANNEL_TRANSIENT_FAILURE &&
|
911
|
+
connectivity_state != GRPC_CHANNEL_READY) {
|
912
|
+
return;
|
913
|
+
}
|
914
|
+
// If the new state is IDLE, treat it as CONNECTING, since it will
|
915
|
+
// immediately transition into CONNECTING anyway.
|
916
|
+
if (connectivity_state == GRPC_CHANNEL_IDLE) {
|
917
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
918
|
+
gpr_log(GPR_INFO,
|
919
|
+
"[WRR %p] subchannel %p, subchannel_list %p (index %" PRIuPTR
|
920
|
+
" of %" PRIuPTR "): treating IDLE as CONNECTING",
|
921
|
+
p, subchannel(), subchannel_list(), Index(),
|
922
|
+
subchannel_list()->num_subchannels());
|
923
|
+
}
|
924
|
+
connectivity_state = GRPC_CHANNEL_CONNECTING;
|
925
|
+
}
|
926
|
+
// If no change, return false.
|
927
|
+
if (logical_connectivity_state_.has_value() &&
|
928
|
+
*logical_connectivity_state_ == connectivity_state) {
|
929
|
+
return;
|
930
|
+
}
|
931
|
+
// Otherwise, update counters and logical state.
|
932
|
+
subchannel_list()->UpdateStateCountersLocked(logical_connectivity_state_,
|
933
|
+
connectivity_state);
|
934
|
+
logical_connectivity_state_ = connectivity_state;
|
935
|
+
}
|
936
|
+
|
937
|
+
//
|
938
|
+
// factory
|
939
|
+
//
|
940
|
+
|
941
|
+
class WeightedRoundRobinFactory : public LoadBalancingPolicyFactory {
|
942
|
+
public:
|
943
|
+
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
|
944
|
+
LoadBalancingPolicy::Args args) const override {
|
945
|
+
return MakeOrphanable<WeightedRoundRobin>(std::move(args));
|
946
|
+
}
|
947
|
+
|
948
|
+
absl::string_view name() const override { return kWeightedRoundRobin; }
|
949
|
+
|
950
|
+
absl::StatusOr<RefCountedPtr<LoadBalancingPolicy::Config>>
|
951
|
+
ParseLoadBalancingConfig(const Json& json) const override {
|
952
|
+
if (json.type() == Json::Type::JSON_NULL) {
|
953
|
+
// priority was mentioned as a policy in the deprecated
|
954
|
+
// loadBalancingPolicy field or in the client API.
|
955
|
+
return absl::InvalidArgumentError(
|
956
|
+
"field:loadBalancingPolicy error:priority policy requires "
|
957
|
+
"configuration. Please use loadBalancingConfig field of service "
|
958
|
+
"config instead.");
|
959
|
+
}
|
960
|
+
return LoadRefCountedFromJson<WeightedRoundRobinConfig>(
|
961
|
+
json, JsonArgs(), "errors validating priority LB policy config");
|
962
|
+
}
|
963
|
+
};
|
964
|
+
|
965
|
+
} // namespace
|
966
|
+
|
967
|
+
void RegisterWeightedRoundRobinLbPolicy(CoreConfiguration::Builder* builder) {
|
968
|
+
builder->lb_policy_registry()->RegisterLoadBalancingPolicyFactory(
|
969
|
+
std::make_unique<WeightedRoundRobinFactory>());
|
970
|
+
}
|
971
|
+
|
972
|
+
} // namespace grpc_core
|