grpc 1.46.3-x86_64-linux → 1.47.0-x86_64-linux
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 +49 -97
- data/include/grpc/event_engine/event_engine.h +42 -7
- data/include/grpc/event_engine/memory_allocator.h +0 -15
- data/include/grpc/event_engine/port.h +1 -1
- data/include/grpc/event_engine/slice.h +286 -0
- data/include/grpc/event_engine/slice_buffer.h +112 -0
- data/include/grpc/grpc_security.h +11 -0
- data/include/grpc/impl/codegen/port_platform.h +100 -36
- data/include/grpc/impl/codegen/slice.h +1 -1
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +18 -30
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +4 -1
- data/src/core/ext/filters/client_channel/backend_metric.cc +17 -12
- data/src/core/ext/filters/client_channel/backend_metric.h +19 -9
- data/src/core/ext/filters/client_channel/backup_poller.cc +5 -5
- data/src/core/ext/filters/client_channel/backup_poller.h +2 -4
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +42 -20
- data/src/core/ext/filters/client_channel/client_channel.cc +60 -17
- data/src/core/ext/filters/client_channel/client_channel.h +26 -6
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +3 -5
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +12 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +5 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +8 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +4 -13
- data/src/core/ext/filters/client_channel/config_selector.cc +1 -0
- data/src/core/ext/filters/client_channel/config_selector.h +7 -5
- data/src/core/ext/filters/client_channel/connector.h +8 -2
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +13 -2
- data/src/core/ext/filters/client_channel/dynamic_filters.h +11 -1
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +2 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +14 -1
- data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -0
- data/src/core/ext/filters/client_channel/http_proxy.cc +10 -2
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +49 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +12 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +9 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +59 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +4 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +6 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +10 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +6 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +408 -0
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +57 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +1038 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +60 -52
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +102 -60
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +157 -96
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +45 -10
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +182 -171
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +39 -36
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +30 -5
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +99 -23
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +6 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +30 -4
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +23 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +75 -11
- data/src/core/ext/filters/client_channel/lb_policy.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +18 -24
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +6 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +4 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +1 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +1 -1
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +5 -0
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +23 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +134 -43
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +10 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +26 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +13 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +2 -0
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +30 -7
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +13 -14
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +5 -2
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +59 -13
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +13 -1
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +8 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +15 -11
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +89 -33
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -11
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +11 -5
- data/src/core/ext/filters/client_channel/retry_filter.cc +42 -2
- data/src/core/ext/filters/client_channel/retry_service_config.cc +8 -9
- data/src/core/ext/filters/client_channel/retry_service_config.h +10 -1
- data/src/core/ext/filters/client_channel/retry_throttle.cc +1 -8
- data/src/core/ext/filters/client_channel/retry_throttle.h +7 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +22 -5
- data/src/core/ext/filters/client_channel/subchannel.cc +156 -160
- data/src/core/ext/filters/client_channel/subchannel.h +80 -20
- data/src/core/ext/filters/client_channel/subchannel_interface.h +41 -23
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +38 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +12 -2
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +6 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +16 -2
- data/src/core/ext/filters/client_channel/subchannel_stream_client.h +12 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +6 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +1 -4
- data/src/core/ext/filters/http/client/http_client_filter.cc +14 -5
- data/src/core/ext/filters/http/client/http_client_filter.h +7 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +5 -10
- data/src/core/ext/filters/http/http_filters_plugin.cc +7 -8
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +1 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +3 -1
- data/src/core/ext/filters/http/server/http_server_filter.cc +80 -247
- data/src/core/ext/filters/http/server/http_server_filter.h +31 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +20 -26
- data/src/core/ext/filters/message_size/message_size_filter.h +2 -2
- data/src/core/ext/filters/rbac/rbac_filter.cc +1 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +101 -135
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +9 -7
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +44 -15
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -1
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +69 -20
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +5 -0
- data/src/core/ext/transport/chttp2/transport/context_list.cc +4 -0
- data/src/core/ext/transport/chttp2/transport/context_list.h +4 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +6 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +6 -2
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +7 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.h +4 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +6 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +12 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +4 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +14 -12
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +15 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -7
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +55 -37
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +38 -21
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +0 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +24 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +27 -6
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +13 -9
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/stream_map.h +1 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +2 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +38 -2
- data/src/core/ext/transport/inproc/inproc_transport.cc +8 -5
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.c +47 -0
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +109 -0
- data/src/core/ext/xds/certificate_provider_store.cc +4 -2
- data/src/core/ext/xds/certificate_provider_store.h +1 -1
- data/src/core/ext/xds/xds_certificate_provider.cc +4 -1
- data/src/core/ext/xds/xds_certificate_provider.h +1 -1
- data/src/core/ext/xds/xds_channel_stack_modifier.cc +5 -5
- data/src/core/ext/xds/xds_client.cc +46 -22
- data/src/core/ext/xds/xds_cluster.cc +106 -16
- data/src/core/ext/xds/xds_cluster.h +3 -0
- data/src/core/ext/xds/xds_http_fault_filter.cc +3 -3
- data/src/core/ext/xds/xds_listener.cc +19 -9
- data/src/core/ext/xds/xds_server_config_fetcher.cc +2 -1
- data/src/core/lib/address_utils/sockaddr_utils.cc +56 -23
- data/src/core/lib/address_utils/sockaddr_utils.h +7 -4
- data/src/core/lib/avl/avl.h +3 -1
- data/src/core/lib/channel/call_finalization.h +4 -0
- data/src/core/lib/channel/call_tracer.h +8 -2
- data/src/core/lib/channel/channel_args.cc +41 -22
- data/src/core/lib/channel/channel_args.h +33 -3
- data/src/core/lib/channel/channel_args_preconditioning.cc +3 -3
- data/src/core/lib/channel/channel_args_preconditioning.h +3 -2
- data/src/core/lib/channel/channel_stack.cc +41 -3
- data/src/core/lib/channel/channel_stack.h +49 -3
- data/src/core/lib/channel/channel_stack_builder.cc +9 -19
- data/src/core/lib/channel/channel_stack_builder.h +15 -27
- data/src/core/lib/channel/channel_stack_builder_impl.cc +36 -41
- data/src/core/lib/channel/channel_stack_builder_impl.h +3 -6
- data/src/core/lib/channel/channel_trace.cc +8 -13
- data/src/core/lib/channel/channel_trace.h +6 -3
- data/src/core/lib/channel/channelz.cc +8 -13
- data/src/core/lib/channel/channelz.h +13 -4
- data/src/core/lib/channel/channelz_registry.cc +7 -14
- data/src/core/lib/channel/channelz_registry.h +10 -9
- data/src/core/lib/channel/connected_channel.cc +21 -31
- data/src/core/lib/channel/connected_channel.h +1 -0
- data/src/core/lib/channel/promise_based_filter.cc +444 -189
- data/src/core/lib/channel/promise_based_filter.h +160 -27
- data/src/core/lib/channel/status_util.cc +2 -0
- data/src/core/lib/channel/status_util.h +0 -3
- data/src/core/lib/compression/compression_internal.cc +45 -10
- data/src/core/lib/compression/compression_internal.h +1 -1
- data/src/core/lib/config/core_configuration.cc +3 -0
- data/src/core/lib/config/core_configuration.h +2 -1
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +4 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +3 -2
- data/src/core/lib/event_engine/default_event_engine_factory.cc +8 -2
- data/src/core/lib/event_engine/event_engine.cc +12 -2
- data/src/core/lib/event_engine/event_engine_factory.h +5 -0
- data/src/core/lib/event_engine/handle_containers.h +67 -0
- data/src/core/lib/event_engine/iomgr_engine.cc +206 -0
- data/src/core/lib/event_engine/iomgr_engine.h +118 -0
- data/src/core/lib/event_engine/memory_allocator.cc +12 -4
- data/src/core/lib/event_engine/resolved_address.cc +4 -2
- data/src/core/lib/event_engine/slice.cc +102 -0
- data/src/core/lib/event_engine/slice_buffer.cc +50 -0
- data/src/core/lib/{iomgr/event_engine/pollset.h → event_engine/trace.cc} +3 -10
- data/src/core/lib/{iomgr/endpoint_pair_event_engine.cc → event_engine/trace.h} +12 -14
- data/src/core/lib/gpr/log.cc +5 -0
- data/src/core/lib/gpr/tls.h +3 -5
- data/src/core/lib/gprpp/bitset.h +5 -1
- data/src/core/lib/gprpp/chunked_vector.h +4 -0
- data/src/core/lib/gprpp/construct_destruct.h +1 -0
- data/src/core/lib/gprpp/dual_ref_counted.h +1 -4
- data/src/core/lib/gprpp/examine_stack.h +0 -1
- data/src/core/lib/gprpp/fork.cc +3 -6
- data/src/core/lib/gprpp/global_config.h +2 -4
- data/src/core/lib/gprpp/global_config_env.cc +3 -2
- data/src/core/lib/gprpp/global_config_env.h +3 -1
- data/src/core/lib/gprpp/global_config_generic.h +0 -4
- data/src/core/lib/gprpp/host_port.cc +2 -0
- data/src/core/lib/gprpp/manual_constructor.h +0 -1
- data/src/core/lib/gprpp/match.h +2 -0
- data/src/core/lib/gprpp/memory.h +1 -5
- data/src/core/lib/gprpp/orphanable.h +1 -4
- data/src/core/lib/gprpp/ref_counted.h +1 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +1 -1
- data/src/core/lib/gprpp/stat.h +0 -2
- data/src/core/lib/gprpp/stat_posix.cc +7 -2
- data/src/core/lib/gprpp/status_helper.cc +8 -4
- data/src/core/lib/gprpp/status_helper.h +4 -0
- data/src/core/lib/gprpp/sync.h +3 -1
- data/src/core/lib/gprpp/table.h +10 -0
- data/src/core/lib/gprpp/thd.h +2 -5
- data/src/core/lib/gprpp/thd_posix.cc +4 -2
- data/src/core/lib/gprpp/thd_windows.cc +2 -0
- data/src/core/lib/gprpp/time.cc +8 -0
- data/src/core/lib/gprpp/time.h +6 -1
- data/src/core/lib/gprpp/time_util.cc +4 -0
- data/src/core/lib/gprpp/time_util.h +1 -1
- data/src/core/lib/gprpp/unique_type_name.h +104 -0
- data/src/core/lib/http/format_request.cc +29 -0
- data/src/core/lib/http/format_request.h +2 -0
- data/src/core/lib/http/httpcli.cc +88 -81
- data/src/core/lib/http/httpcli.h +39 -7
- data/src/core/lib/http/httpcli_security_connector.cc +3 -4
- data/src/core/lib/iomgr/endpoint.cc +4 -4
- data/src/core/lib/iomgr/endpoint.h +6 -4
- data/src/core/lib/iomgr/endpoint_cfstream.cc +7 -4
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -1
- data/src/core/lib/iomgr/ev_posix.cc +1 -4
- data/src/core/lib/iomgr/exec_ctx.h +1 -2
- data/src/core/lib/iomgr/internal_errqueue.cc +38 -47
- data/src/core/lib/iomgr/internal_errqueue.h +1 -6
- data/src/core/lib/iomgr/iomgr.cc +0 -1
- data/src/core/{ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc → lib/iomgr/iomgr_fwd.h} +9 -12
- data/src/core/lib/iomgr/pollset_set.h +1 -2
- data/src/core/lib/iomgr/port.h +25 -6
- data/src/core/lib/iomgr/resolve_address.cc +8 -0
- data/src/core/lib/iomgr/resolve_address.h +21 -14
- data/src/core/lib/iomgr/resolve_address_impl.h +2 -3
- data/src/core/lib/iomgr/resolve_address_posix.cc +8 -14
- data/src/core/lib/iomgr/resolve_address_posix.h +5 -2
- data/src/core/lib/iomgr/resolve_address_windows.cc +7 -14
- data/src/core/lib/iomgr/resolve_address_windows.h +5 -2
- data/src/core/lib/iomgr/sockaddr.h +2 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +2 -0
- data/src/core/lib/iomgr/sockaddr_windows.h +2 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +3 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +10 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +12 -5
- data/src/core/lib/iomgr/tcp_client_windows.cc +13 -6
- data/src/core/lib/iomgr/tcp_posix.cc +9 -27
- data/src/core/lib/iomgr/tcp_server_posix.cc +26 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +30 -27
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +7 -4
- data/src/core/lib/iomgr/tcp_server_windows.cc +13 -5
- data/src/core/lib/iomgr/tcp_windows.cc +7 -4
- data/src/core/lib/json/json.h +1 -2
- data/src/core/lib/json/json_reader.cc +9 -1
- data/src/core/lib/json/json_util.cc +7 -0
- data/src/core/lib/json/json_util.h +10 -1
- data/src/core/lib/json/json_writer.cc +6 -1
- data/src/core/lib/promise/activity.cc +1 -1
- data/src/core/lib/promise/activity.h +6 -6
- data/src/core/lib/promise/arena_promise.h +11 -1
- data/src/core/lib/promise/call_push_pull.h +4 -0
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/detail/basic_seq.h +2 -2
- data/src/core/lib/promise/detail/promise_factory.h +0 -1
- data/src/core/lib/promise/latch.h +0 -1
- data/src/core/lib/promise/loop.h +1 -0
- data/src/core/lib/promise/race.h +0 -1
- data/src/core/lib/promise/seq.h +0 -2
- data/src/core/lib/promise/sleep.cc +2 -0
- data/src/core/lib/promise/sleep.h +10 -0
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resolver/resolver_factory.h +1 -2
- data/src/core/lib/resolver/server_address.cc +9 -3
- data/src/core/lib/resolver/server_address.h +4 -4
- data/src/core/lib/resource_quota/api.cc +14 -1
- data/src/core/lib/resource_quota/api.h +4 -1
- data/src/core/lib/resource_quota/arena.cc +0 -6
- data/src/core/lib/resource_quota/arena.h +1 -2
- data/src/core/lib/resource_quota/memory_quota.cc +47 -5
- data/src/core/lib/resource_quota/memory_quota.h +24 -5
- data/src/core/lib/resource_quota/resource_quota.h +8 -0
- data/src/core/lib/resource_quota/thread_quota.cc +2 -0
- data/src/core/lib/resource_quota/thread_quota.h +4 -0
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +3 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +8 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.h +2 -2
- data/src/core/lib/security/credentials/call_creds_util.cc +2 -0
- data/src/core/lib/security/credentials/channel_creds_registry.h +1 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +7 -3
- data/src/core/lib/security/credentials/composite/composite_credentials.h +5 -4
- data/src/core/lib/security/credentials/credentials.h +17 -10
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +81 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +8 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +3 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +13 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +25 -15
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +2 -2
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +4 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -2
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +8 -2
- data/src/core/lib/security/credentials/insecure/insecure_credentials.h +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -2
- data/src/core/lib/security/credentials/local/local_credentials.cc +8 -2
- data/src/core/lib/security/credentials/local/local_credentials.h +2 -2
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +10 -6
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +4 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +4 -1
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +8 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +4 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +10 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +5 -7
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +26 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +28 -4
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +10 -0
- data/src/core/lib/security/credentials/tls/tls_credentials.h +2 -2
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +12 -3
- data/src/core/lib/security/credentials/xds/xds_credentials.h +5 -5
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +1 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +6 -8
- data/src/core/lib/security/transport/secure_endpoint.cc +23 -12
- data/src/core/lib/security/transport/security_handshaker.cc +5 -5
- data/src/core/lib/security/transport/security_handshaker.h +1 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +3 -2
- data/src/core/lib/service_config/service_config.h +4 -8
- data/src/core/lib/service_config/service_config_call_data.h +4 -1
- data/src/core/lib/service_config/service_config_impl.cc +7 -0
- data/src/core/lib/service_config/service_config_impl.h +9 -2
- data/src/core/lib/service_config/service_config_parser.cc +8 -0
- data/src/core/lib/service_config/service_config_parser.h +7 -0
- data/src/core/lib/slice/b64.cc +1 -1
- data/src/core/lib/slice/b64.h +2 -0
- data/src/core/lib/slice/percent_encoding.cc +4 -1
- data/src/core/lib/slice/percent_encoding.h +0 -6
- data/src/core/lib/slice/slice.cc +2 -1
- data/src/core/lib/slice/slice.h +10 -5
- data/src/core/lib/slice/slice_api.cc +1 -1
- data/src/core/lib/slice/slice_buffer.cc +50 -23
- data/src/core/lib/slice/slice_buffer.h +106 -0
- data/src/core/lib/slice/slice_buffer_api.cc +35 -0
- data/src/core/lib/slice/slice_internal.h +4 -3
- data/src/core/lib/slice/slice_refcount.h +2 -3
- data/src/core/lib/slice/slice_refcount_base.h +2 -3
- data/src/core/lib/slice/slice_split.cc +3 -0
- data/src/core/lib/slice/slice_split.h +0 -4
- data/src/core/lib/slice/slice_string_helpers.cc +4 -0
- data/src/core/lib/slice/slice_string_helpers.h +1 -4
- data/src/core/lib/surface/builtins.cc +7 -2
- data/src/core/lib/surface/byte_buffer.cc +7 -1
- data/src/core/lib/surface/byte_buffer_reader.cc +4 -4
- data/src/core/lib/surface/call.cc +41 -26
- data/src/core/lib/surface/call.h +16 -2
- data/src/core/lib/surface/call_details.cc +4 -4
- data/src/core/lib/surface/call_log_batch.cc +7 -1
- data/src/core/lib/surface/call_test_only.h +4 -1
- data/src/core/lib/surface/channel.cc +179 -242
- data/src/core/lib/surface/channel.h +94 -57
- data/src/core/lib/surface/channel_init.h +2 -0
- data/src/core/lib/surface/channel_ping.cc +8 -2
- data/src/core/lib/surface/channel_stack_type.cc +0 -2
- data/src/core/lib/surface/channel_stack_type.h +0 -2
- data/src/core/lib/surface/completion_queue.cc +14 -6
- data/src/core/lib/surface/completion_queue.h +5 -1
- data/src/core/lib/surface/completion_queue_factory.cc +1 -0
- data/src/core/lib/surface/completion_queue_factory.h +1 -3
- data/src/core/lib/surface/event_string.cc +1 -7
- data/src/core/lib/surface/event_string.h +1 -1
- data/src/core/lib/surface/init.cc +17 -45
- data/src/core/lib/surface/init.h +0 -8
- data/src/core/lib/surface/lame_client.cc +64 -110
- data/src/core/lib/surface/lame_client.h +40 -2
- data/src/core/lib/surface/metadata_array.cc +2 -0
- data/src/core/lib/surface/server.cc +69 -56
- data/src/core/lib/surface/server.h +39 -9
- data/src/core/lib/surface/validate_metadata.cc +2 -5
- data/src/core/lib/surface/validate_metadata.h +3 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +3 -1
- data/src/core/lib/transport/bdp_estimator.h +2 -3
- data/src/core/lib/transport/byte_stream.cc +4 -3
- data/src/core/lib/transport/byte_stream.h +5 -1
- data/src/core/lib/transport/connectivity_state.cc +6 -4
- data/src/core/lib/transport/connectivity_state.h +2 -3
- data/src/core/lib/transport/error_utils.cc +4 -2
- data/src/core/lib/transport/error_utils.h +5 -1
- data/src/core/lib/{channel → transport}/handshaker.cc +9 -4
- data/src/core/lib/{channel → transport}/handshaker.h +13 -6
- data/src/core/lib/{channel → transport}/handshaker_factory.h +9 -10
- data/src/core/lib/{channel → transport}/handshaker_registry.cc +5 -1
- data/src/core/lib/{channel → transport}/handshaker_registry.h +5 -4
- data/src/core/{ext/filters/client_channel → lib/transport}/http_connect_handshaker.cc +24 -10
- data/src/core/{ext/filters/client_channel → lib/transport}/http_connect_handshaker.h +3 -3
- data/src/core/lib/transport/metadata_batch.cc +287 -0
- data/src/core/lib/transport/metadata_batch.h +133 -264
- data/src/core/lib/transport/parsed_metadata.cc +2 -0
- data/src/core/lib/transport/parsed_metadata.h +10 -3
- data/src/core/lib/transport/status_conversion.cc +2 -0
- data/src/core/lib/transport/status_conversion.h +2 -2
- data/src/core/lib/transport/tcp_connect_handshaker.cc +253 -0
- data/src/core/lib/transport/tcp_connect_handshaker.h +39 -0
- data/src/core/lib/transport/timeout_encoding.cc +2 -6
- data/src/core/lib/transport/timeout_encoding.h +5 -1
- data/src/core/lib/transport/transport.cc +18 -17
- data/src/core/lib/transport/transport.h +28 -2
- data/src/core/lib/transport/transport_impl.h +10 -0
- data/src/core/lib/transport/transport_op_string.cc +9 -10
- data/src/core/lib/uri/uri_parser.cc +11 -3
- data/src/core/lib/uri/uri_parser.h +0 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +11 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -0
- data/src/ruby/ext/grpc/extconf.rb +2 -2
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/abseil-cpp/absl/cleanup/cleanup.h +140 -0
- data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +100 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +504 -0
- metadata +36 -29
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +0 -31
- data/src/core/lib/event_engine/sockaddr.cc +0 -40
- data/src/core/lib/event_engine/sockaddr.h +0 -44
- data/src/core/lib/gprpp/capture.h +0 -76
- data/src/core/lib/iomgr/event_engine/closure.cc +0 -77
- data/src/core/lib/iomgr/event_engine/closure.h +0 -42
- data/src/core/lib/iomgr/event_engine/endpoint.cc +0 -172
- data/src/core/lib/iomgr/event_engine/endpoint.h +0 -52
- data/src/core/lib/iomgr/event_engine/iomgr.cc +0 -85
- data/src/core/lib/iomgr/event_engine/pollset.cc +0 -87
- data/src/core/lib/iomgr/event_engine/promise.h +0 -51
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +0 -47
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +0 -37
- data/src/core/lib/iomgr/event_engine/resolver.cc +0 -133
- data/src/core/lib/iomgr/event_engine/resolver.h +0 -56
- data/src/core/lib/iomgr/event_engine/tcp.cc +0 -296
- data/src/core/lib/iomgr/event_engine/timer.cc +0 -62
@@ -16,27 +16,54 @@
|
|
16
16
|
|
17
17
|
#include <grpc/support/port_platform.h>
|
18
18
|
|
19
|
+
#include <inttypes.h>
|
19
20
|
#include <stdlib.h>
|
20
|
-
#include <string.h>
|
21
21
|
|
22
|
+
#include <algorithm>
|
23
|
+
#include <atomic>
|
24
|
+
#include <cmath>
|
25
|
+
#include <map>
|
26
|
+
#include <memory>
|
27
|
+
#include <string>
|
28
|
+
#include <utility>
|
29
|
+
#include <vector>
|
30
|
+
|
31
|
+
#include "absl/base/attributes.h"
|
32
|
+
#include "absl/container/inlined_vector.h"
|
33
|
+
#include "absl/memory/memory.h"
|
34
|
+
#include "absl/status/status.h"
|
35
|
+
#include "absl/status/statusor.h"
|
22
36
|
#include "absl/strings/numbers.h"
|
23
37
|
#include "absl/strings/str_cat.h"
|
38
|
+
#include "absl/strings/string_view.h"
|
39
|
+
#include "absl/types/optional.h"
|
40
|
+
|
24
41
|
#define XXH_INLINE_ALL
|
25
42
|
#include "xxhash.h"
|
26
43
|
|
27
|
-
#include <grpc/
|
44
|
+
#include <grpc/impl/codegen/connectivity_state.h>
|
45
|
+
#include <grpc/impl/codegen/grpc_types.h>
|
46
|
+
#include <grpc/support/log.h>
|
28
47
|
|
48
|
+
#include "src/core/ext/filters/client_channel/lb_policy.h"
|
29
49
|
#include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
|
50
|
+
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
30
51
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
31
|
-
#include "src/core/ext/filters/client_channel/
|
52
|
+
#include "src/core/ext/filters/client_channel/subchannel_interface.h"
|
32
53
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
33
|
-
#include "src/core/lib/channel/channel_args.h"
|
34
54
|
#include "src/core/lib/debug/trace.h"
|
35
55
|
#include "src/core/lib/gpr/string.h"
|
56
|
+
#include "src/core/lib/gprpp/debug_location.h"
|
57
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
58
|
+
#include "src/core/lib/gprpp/ref_counted.h"
|
36
59
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
37
|
-
#include "src/core/lib/
|
60
|
+
#include "src/core/lib/iomgr/closure.h"
|
61
|
+
#include "src/core/lib/iomgr/error.h"
|
62
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
63
|
+
#include "src/core/lib/iomgr/work_serializer.h"
|
64
|
+
#include "src/core/lib/json/json.h"
|
65
|
+
#include "src/core/lib/resolver/server_address.h"
|
38
66
|
#include "src/core/lib/transport/connectivity_state.h"
|
39
|
-
#include "src/core/lib/transport/error_utils.h"
|
40
67
|
|
41
68
|
namespace grpc_core {
|
42
69
|
|
@@ -143,8 +170,6 @@ class RingHash : public LoadBalancingPolicy {
|
|
143
170
|
|
144
171
|
const ServerAddress& address() const { return address_; }
|
145
172
|
|
146
|
-
bool seen_failure_since_ready() const { return seen_failure_since_ready_; }
|
147
|
-
|
148
173
|
// Performs connectivity state updates that need to be done both when we
|
149
174
|
// first start watching and when a watcher notification is received.
|
150
175
|
void UpdateConnectivityStateLocked(
|
@@ -157,21 +182,32 @@ class RingHash : public LoadBalancingPolicy {
|
|
157
182
|
grpc_connectivity_state connectivity_state) override;
|
158
183
|
|
159
184
|
ServerAddress address_;
|
185
|
+
|
186
|
+
// Last logical connectivity state seen.
|
187
|
+
// Note that this may differ from the state actually reported by the
|
188
|
+
// subchannel in some cases; for example, once this is set to
|
189
|
+
// TRANSIENT_FAILURE, we do not change it again until we get READY,
|
190
|
+
// so we skip any interim stops in CONNECTING.
|
160
191
|
grpc_connectivity_state last_connectivity_state_ = GRPC_CHANNEL_SHUTDOWN;
|
192
|
+
|
193
|
+
// Connectivity state seen by picker.
|
194
|
+
// Uses an atomic so that it can be accessed outside of the WorkSerializer.
|
161
195
|
std::atomic<grpc_connectivity_state> connectivity_state_for_picker_{
|
162
196
|
GRPC_CHANNEL_IDLE};
|
163
|
-
bool seen_failure_since_ready_ = false;
|
164
197
|
};
|
165
198
|
|
166
199
|
// A list of subchannels.
|
167
200
|
class RingHashSubchannelList
|
168
201
|
: public SubchannelList<RingHashSubchannelList, RingHashSubchannelData> {
|
169
202
|
public:
|
170
|
-
RingHashSubchannelList(RingHash* policy,
|
171
|
-
ServerAddressList addresses,
|
203
|
+
RingHashSubchannelList(RingHash* policy, ServerAddressList addresses,
|
172
204
|
const grpc_channel_args& args)
|
173
|
-
: SubchannelList(policy,
|
174
|
-
|
205
|
+
: SubchannelList(policy,
|
206
|
+
(GRPC_TRACE_FLAG_ENABLED(grpc_lb_ring_hash_trace)
|
207
|
+
? "RingHashSubchannelList"
|
208
|
+
: nullptr),
|
209
|
+
std::move(addresses), policy->channel_control_helper(),
|
210
|
+
args) {
|
175
211
|
// Need to maintain a ref to the LB policy as long as we maintain
|
176
212
|
// any references to subchannels, since the subchannels'
|
177
213
|
// pollset_sets will include the LB policy's pollset_set.
|
@@ -193,9 +229,13 @@ class RingHash : public LoadBalancingPolicy {
|
|
193
229
|
|
194
230
|
// Updates the RH policy's connectivity state based on the
|
195
231
|
// subchannel list's state counters, creating new picker and new ring.
|
196
|
-
//
|
197
|
-
//
|
198
|
-
|
232
|
+
// The index parameter indicates the index into the list of the subchannel
|
233
|
+
// whose status report triggered the call to
|
234
|
+
// UpdateRingHashConnectivityStateLocked().
|
235
|
+
// connection_attempt_complete is true if the subchannel just
|
236
|
+
// finished a connection attempt.
|
237
|
+
void UpdateRingHashConnectivityStateLocked(
|
238
|
+
size_t index, bool connection_attempt_complete);
|
199
239
|
|
200
240
|
// Create a new ring from this subchannel list.
|
201
241
|
RefCountedPtr<Ring> MakeRing();
|
@@ -205,6 +245,10 @@ class RingHash : public LoadBalancingPolicy {
|
|
205
245
|
size_t num_ready_ = 0;
|
206
246
|
size_t num_connecting_ = 0;
|
207
247
|
size_t num_transient_failure_ = 0;
|
248
|
+
|
249
|
+
// The index of the subchannel currently doing an internally
|
250
|
+
// triggered connection attempt, if any.
|
251
|
+
absl::optional<size_t> internally_triggered_connection_index_;
|
208
252
|
};
|
209
253
|
|
210
254
|
class Ring : public RefCounted<Ring> {
|
@@ -259,7 +303,7 @@ class RingHash : public LoadBalancingPolicy {
|
|
259
303
|
[self]() {
|
260
304
|
if (!self->ring_hash_lb_->shutdown_) {
|
261
305
|
for (auto& subchannel : self->subchannels_) {
|
262
|
-
subchannel->
|
306
|
+
subchannel->RequestConnection();
|
263
307
|
}
|
264
308
|
}
|
265
309
|
delete self;
|
@@ -316,7 +360,7 @@ RingHash::Ring::Ring(RingHash* parent,
|
|
316
360
|
ServerAddressWeightAttribute::kServerAddressWeightAttributeKey));
|
317
361
|
AddressWeight address_weight;
|
318
362
|
address_weight.address =
|
319
|
-
grpc_sockaddr_to_string(&sd->address().address(), false);
|
363
|
+
grpc_sockaddr_to_string(&sd->address().address(), false).value();
|
320
364
|
if (weight_attribute != nullptr) {
|
321
365
|
GPR_ASSERT(weight_attribute->weight() != 0);
|
322
366
|
address_weight.weight = weight_attribute->weight();
|
@@ -508,7 +552,7 @@ RingHash::PickResult RingHash::Picker::Pick(PickArgs args) {
|
|
508
552
|
//
|
509
553
|
|
510
554
|
void RingHash::RingHashSubchannelList::StartWatchingLocked() {
|
511
|
-
|
555
|
+
GPR_ASSERT(num_subchannels() != 0);
|
512
556
|
// Check current state of each subchannel synchronously.
|
513
557
|
for (size_t i = 0; i < num_subchannels(); ++i) {
|
514
558
|
grpc_connectivity_state state =
|
@@ -522,7 +566,11 @@ void RingHash::RingHashSubchannelList::StartWatchingLocked() {
|
|
522
566
|
}
|
523
567
|
}
|
524
568
|
// Send updated state to parent based on reported subchannel states.
|
525
|
-
|
569
|
+
// Pretend we're getting this update from the last subchannel, so that
|
570
|
+
// if we need to proactively start connecting, we'll start from the
|
571
|
+
// first subchannel.
|
572
|
+
UpdateRingHashConnectivityStateLocked(num_subchannels() - 1,
|
573
|
+
/*connection_attempt_complete=*/false);
|
526
574
|
}
|
527
575
|
|
528
576
|
void RingHash::RingHashSubchannelList::UpdateStateCountersLocked(
|
@@ -552,47 +600,86 @@ void RingHash::RingHashSubchannelList::UpdateStateCountersLocked(
|
|
552
600
|
}
|
553
601
|
}
|
554
602
|
|
555
|
-
|
556
|
-
|
557
|
-
bool RingHash::RingHashSubchannelList::UpdateRingHashConnectivityStateLocked() {
|
603
|
+
void RingHash::RingHashSubchannelList::UpdateRingHashConnectivityStateLocked(
|
604
|
+
size_t index, bool connection_attempt_complete) {
|
558
605
|
RingHash* p = static_cast<RingHash*>(policy());
|
559
606
|
// Only set connectivity state if this is the current subchannel list.
|
560
|
-
if (p->subchannel_list_.get() != this) return
|
607
|
+
if (p->subchannel_list_.get() != this) return;
|
561
608
|
// The overall aggregation rules here are:
|
562
609
|
// 1. If there is at least one subchannel in READY state, report READY.
|
563
610
|
// 2. If there are 2 or more subchannels in TRANSIENT_FAILURE state, report
|
564
|
-
//
|
611
|
+
// TRANSIENT_FAILURE.
|
565
612
|
// 3. If there is at least one subchannel in CONNECTING state, report
|
566
|
-
//
|
567
|
-
// 4. If there is
|
568
|
-
//
|
613
|
+
// CONNECTING.
|
614
|
+
// 4. If there is one subchannel in TRANSIENT_FAILURE state and there is
|
615
|
+
// more than one subchannel, report CONNECTING.
|
616
|
+
// 5. If there is at least one subchannel in IDLE state, report IDLE.
|
617
|
+
// 6. Otherwise, report TRANSIENT_FAILURE.
|
618
|
+
//
|
619
|
+
// We set start_connection_attempt to true if we match rules 2, 3, or 6.
|
620
|
+
grpc_connectivity_state state;
|
621
|
+
absl::Status status;
|
622
|
+
bool start_connection_attempt = false;
|
569
623
|
if (num_ready_ > 0) {
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
624
|
+
state = GRPC_CHANNEL_READY;
|
625
|
+
} else if (num_transient_failure_ >= 2) {
|
626
|
+
state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
627
|
+
status = absl::UnavailableError("connections to backends failing");
|
628
|
+
start_connection_attempt = true;
|
629
|
+
} else if (num_connecting_ > 0) {
|
630
|
+
state = GRPC_CHANNEL_CONNECTING;
|
631
|
+
} else if (num_transient_failure_ == 1 && num_subchannels() > 1) {
|
632
|
+
state = GRPC_CHANNEL_CONNECTING;
|
633
|
+
start_connection_attempt = true;
|
634
|
+
} else if (num_idle_ > 0) {
|
635
|
+
state = GRPC_CHANNEL_IDLE;
|
636
|
+
} else {
|
637
|
+
state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
638
|
+
status = absl::UnavailableError("connections to backends failing");
|
639
|
+
start_connection_attempt = true;
|
576
640
|
}
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
641
|
+
// Generate new picker and return it to the channel.
|
642
|
+
// Note that we use our own picker regardless of connectivity state.
|
643
|
+
p->channel_control_helper()->UpdateState(
|
644
|
+
state, status,
|
645
|
+
absl::make_unique<Picker>(p->Ref(DEBUG_LOCATION, "RingHashPicker"),
|
646
|
+
p->ring_));
|
647
|
+
// While the ring_hash policy is reporting TRANSIENT_FAILURE, it will
|
648
|
+
// not be getting any pick requests from the priority policy.
|
649
|
+
// However, because the ring_hash policy does not attempt to
|
650
|
+
// reconnect to subchannels unless it is getting pick requests,
|
651
|
+
// it will need special handling to ensure that it will eventually
|
652
|
+
// recover from TRANSIENT_FAILURE state once the problem is resolved.
|
653
|
+
// Specifically, it will make sure that it is attempting to connect to
|
654
|
+
// at least one subchannel at any given time. After a given subchannel
|
655
|
+
// fails a connection attempt, it will move on to the next subchannel
|
656
|
+
// in the ring. It will keep doing this until one of the subchannels
|
657
|
+
// successfully connects, at which point it will report READY and stop
|
658
|
+
// proactively trying to connect. The policy will remain in
|
659
|
+
// TRANSIENT_FAILURE until at least one subchannel becomes connected,
|
660
|
+
// even if subchannels are in state CONNECTING during that time.
|
661
|
+
//
|
662
|
+
// Note that we do the same thing when the policy is in state
|
663
|
+
// CONNECTING, just to ensure that we don't remain in CONNECTING state
|
664
|
+
// indefinitely if there are no new picks coming in.
|
665
|
+
if (internally_triggered_connection_index_.has_value() &&
|
666
|
+
*internally_triggered_connection_index_ == index &&
|
667
|
+
connection_attempt_complete) {
|
668
|
+
internally_triggered_connection_index_.reset();
|
582
669
|
}
|
583
|
-
if (
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
670
|
+
if (start_connection_attempt &&
|
671
|
+
!internally_triggered_connection_index_.has_value()) {
|
672
|
+
size_t next_index = (index + 1) % num_subchannels();
|
673
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_ring_hash_trace)) {
|
674
|
+
gpr_log(GPR_INFO,
|
675
|
+
"[RH %p] triggering internal connection attempt for subchannel "
|
676
|
+
"%p, subchannel_list %p (index %" PRIuPTR " of %" PRIuPTR ")",
|
677
|
+
p, subchannel(next_index)->subchannel(), this, next_index,
|
678
|
+
num_subchannels());
|
679
|
+
}
|
680
|
+
internally_triggered_connection_index_ = next_index;
|
681
|
+
subchannel(next_index)->subchannel()->RequestConnection();
|
589
682
|
}
|
590
|
-
absl::Status status =
|
591
|
-
absl::UnavailableError("connections to backend failing or idle");
|
592
|
-
p->channel_control_helper()->UpdateState(
|
593
|
-
GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
594
|
-
absl::make_unique<TransientFailurePicker>(status));
|
595
|
-
return true;
|
596
683
|
}
|
597
684
|
|
598
685
|
RefCountedPtr<RingHash::Ring> RingHash::RingHashSubchannelList::MakeRing() {
|
@@ -617,25 +704,21 @@ void RingHash::RingHashSubchannelData::UpdateConnectivityStateLocked(
|
|
617
704
|
ConnectivityStateName(last_connectivity_state_),
|
618
705
|
ConnectivityStateName(connectivity_state));
|
619
706
|
}
|
620
|
-
// Decide what state to report for aggregation
|
621
|
-
//
|
622
|
-
//
|
623
|
-
//
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
seen_failure_since_ready_ = true;
|
628
|
-
}
|
629
|
-
subchannel_list()->UpdateStateCountersLocked(last_connectivity_state_,
|
630
|
-
connectivity_state);
|
631
|
-
} else {
|
632
|
-
if (connectivity_state == GRPC_CHANNEL_READY) {
|
633
|
-
seen_failure_since_ready_ = false;
|
634
|
-
subchannel_list()->UpdateStateCountersLocked(
|
635
|
-
GRPC_CHANNEL_TRANSIENT_FAILURE, connectivity_state);
|
636
|
-
}
|
707
|
+
// Decide what state to report for the purposes of aggregation and
|
708
|
+
// picker behavior.
|
709
|
+
// If the last recorded state was TRANSIENT_FAILURE, ignore the update
|
710
|
+
// unless the new state is READY.
|
711
|
+
if (last_connectivity_state_ == GRPC_CHANNEL_TRANSIENT_FAILURE &&
|
712
|
+
connectivity_state != GRPC_CHANNEL_READY) {
|
713
|
+
return;
|
637
714
|
}
|
638
|
-
//
|
715
|
+
// Update state counters used for aggregation.
|
716
|
+
subchannel_list()->UpdateStateCountersLocked(last_connectivity_state_,
|
717
|
+
connectivity_state);
|
718
|
+
// Update state seen by picker.
|
719
|
+
connectivity_state_for_picker_.store(connectivity_state,
|
720
|
+
std::memory_order_relaxed);
|
721
|
+
// Update last seen connectivity state.
|
639
722
|
last_connectivity_state_ = connectivity_state;
|
640
723
|
}
|
641
724
|
|
@@ -643,15 +726,11 @@ void RingHash::RingHashSubchannelData::ProcessConnectivityChangeLocked(
|
|
643
726
|
grpc_connectivity_state connectivity_state) {
|
644
727
|
RingHash* p = static_cast<RingHash*>(subchannel_list()->policy());
|
645
728
|
GPR_ASSERT(subchannel() != nullptr);
|
646
|
-
// Update connectivity state used by picker.
|
647
|
-
connectivity_state_for_picker_.store(connectivity_state,
|
648
|
-
std::memory_order_relaxed);
|
649
729
|
// If the new state is TRANSIENT_FAILURE, re-resolve.
|
650
730
|
// Only do this if we've started watching, not at startup time.
|
651
731
|
// Otherwise, if the subchannel was already in state TRANSIENT_FAILURE
|
652
732
|
// when the subchannel list was created, we'd wind up in a constant
|
653
733
|
// loop of re-resolution.
|
654
|
-
// Also attempt to reconnect.
|
655
734
|
if (connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
656
735
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_ring_hash_trace)) {
|
657
736
|
gpr_log(GPR_INFO,
|
@@ -665,28 +744,10 @@ void RingHash::RingHashSubchannelData::ProcessConnectivityChangeLocked(
|
|
665
744
|
UpdateConnectivityStateLocked(connectivity_state);
|
666
745
|
// Update the RH policy's connectivity state, creating new picker and new
|
667
746
|
// ring.
|
668
|
-
bool
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
// However, because the ring_hash policy does not attempt to
|
673
|
-
// reconnect to subchannels unless it is getting pick requests,
|
674
|
-
// it will need special handling to ensure that it will eventually
|
675
|
-
// recover from TRANSIENT_FAILURE state once the problem is resolved.
|
676
|
-
// Specifically, it will make sure that it is attempting to connect to
|
677
|
-
// at least one subchannel at any given time. After a given subchannel
|
678
|
-
// fails a connection attempt, it will move on to the next subchannel
|
679
|
-
// in the ring. It will keep doing this until one of the subchannels
|
680
|
-
// successfully connects, at which point it will report READY and stop
|
681
|
-
// proactively trying to connect. The policy will remain in
|
682
|
-
// TRANSIENT_FAILURE until at least one subchannel becomes connected,
|
683
|
-
// even if subchannels are in state CONNECTING during that time.
|
684
|
-
if (transient_failure &&
|
685
|
-
connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
686
|
-
size_t next_index = (Index() + 1) % subchannel_list()->num_subchannels();
|
687
|
-
RingHashSubchannelData* next_sd = subchannel_list()->subchannel(next_index);
|
688
|
-
next_sd->subchannel()->AttemptToConnect();
|
689
|
-
}
|
747
|
+
bool connection_attempt_complete =
|
748
|
+
connectivity_state != GRPC_CHANNEL_CONNECTING;
|
749
|
+
subchannel_list()->UpdateRingHashConnectivityStateLocked(
|
750
|
+
Index(), connection_attempt_complete);
|
690
751
|
}
|
691
752
|
|
692
753
|
//
|
@@ -745,7 +806,7 @@ void RingHash::UpdateLocked(UpdateArgs args) {
|
|
745
806
|
if (subchannel_list_ != nullptr) return;
|
746
807
|
}
|
747
808
|
subchannel_list_ = MakeOrphanable<RingHashSubchannelList>(
|
748
|
-
this,
|
809
|
+
this, std::move(addresses), *args.args);
|
749
810
|
if (subchannel_list_->num_subchannels() == 0) {
|
750
811
|
// If the new list is empty, immediately transition to TRANSIENT_FAILURE.
|
751
812
|
absl::Status status =
|
@@ -22,54 +22,79 @@
|
|
22
22
|
|
23
23
|
#include <grpc/support/port_platform.h>
|
24
24
|
|
25
|
+
#include <inttypes.h>
|
25
26
|
#include <stdlib.h>
|
27
|
+
#include <string.h>
|
26
28
|
|
27
29
|
#include <algorithm>
|
28
30
|
#include <deque>
|
29
|
-
#include <functional>
|
30
31
|
#include <list>
|
31
32
|
#include <map>
|
33
|
+
#include <memory>
|
32
34
|
#include <random>
|
35
|
+
#include <set>
|
33
36
|
#include <string>
|
34
37
|
#include <unordered_map>
|
35
38
|
#include <utility>
|
39
|
+
#include <vector>
|
36
40
|
|
41
|
+
#include "absl/base/thread_annotations.h"
|
37
42
|
#include "absl/container/inlined_vector.h"
|
38
43
|
#include "absl/hash/hash.h"
|
39
44
|
#include "absl/memory/memory.h"
|
45
|
+
#include "absl/status/status.h"
|
46
|
+
#include "absl/status/statusor.h"
|
40
47
|
#include "absl/strings/str_cat.h"
|
48
|
+
#include "absl/strings/str_format.h"
|
41
49
|
#include "absl/strings/str_join.h"
|
42
50
|
#include "absl/strings/string_view.h"
|
43
51
|
#include "absl/strings/strip.h"
|
52
|
+
#include "absl/types/optional.h"
|
53
|
+
#include "upb/upb.h"
|
44
54
|
#include "upb/upb.hpp"
|
45
55
|
|
56
|
+
#include <grpc/byte_buffer.h>
|
57
|
+
#include <grpc/byte_buffer_reader.h>
|
46
58
|
#include <grpc/grpc.h>
|
47
|
-
#include <grpc/
|
48
|
-
#include <grpc/impl/codegen/byte_buffer_reader.h>
|
59
|
+
#include <grpc/impl/codegen/connectivity_state.h>
|
49
60
|
#include <grpc/impl/codegen/grpc_types.h>
|
50
|
-
#include <grpc/
|
61
|
+
#include <grpc/impl/codegen/propagation_bits.h>
|
62
|
+
#include <grpc/slice.h>
|
63
|
+
#include <grpc/status.h>
|
64
|
+
#include <grpc/support/log.h>
|
51
65
|
|
52
66
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
53
67
|
#include "src/core/ext/filters/client_channel/lb_policy.h"
|
54
68
|
#include "src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h"
|
55
69
|
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
56
70
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
71
|
+
#include "src/core/ext/filters/client_channel/subchannel_interface.h"
|
57
72
|
#include "src/core/lib/backoff/backoff.h"
|
73
|
+
#include "src/core/lib/channel/channel_args.h"
|
74
|
+
#include "src/core/lib/channel/channelz.h"
|
58
75
|
#include "src/core/lib/config/core_configuration.h"
|
59
|
-
#include "src/core/lib/
|
60
|
-
#include "src/core/lib/
|
76
|
+
#include "src/core/lib/debug/trace.h"
|
77
|
+
#include "src/core/lib/gprpp/debug_location.h"
|
61
78
|
#include "src/core/lib/gprpp/dual_ref_counted.h"
|
62
79
|
#include "src/core/lib/gprpp/orphanable.h"
|
63
|
-
#include "src/core/lib/gprpp/
|
80
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
64
81
|
#include "src/core/lib/gprpp/sync.h"
|
82
|
+
#include "src/core/lib/gprpp/time.h"
|
83
|
+
#include "src/core/lib/iomgr/closure.h"
|
84
|
+
#include "src/core/lib/iomgr/error.h"
|
65
85
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
86
|
+
#include "src/core/lib/iomgr/pollset_set.h"
|
66
87
|
#include "src/core/lib/iomgr/timer.h"
|
88
|
+
#include "src/core/lib/iomgr/work_serializer.h"
|
67
89
|
#include "src/core/lib/json/json.h"
|
68
90
|
#include "src/core/lib/json/json_util.h"
|
69
91
|
#include "src/core/lib/resolver/resolver_registry.h"
|
92
|
+
#include "src/core/lib/resolver/server_address.h"
|
70
93
|
#include "src/core/lib/security/credentials/credentials.h"
|
71
94
|
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
|
72
95
|
#include "src/core/lib/service_config/service_config_impl.h"
|
96
|
+
#include "src/core/lib/slice/slice_internal.h"
|
97
|
+
#include "src/core/lib/slice/slice_refcount.h"
|
73
98
|
#include "src/core/lib/surface/call.h"
|
74
99
|
#include "src/core/lib/surface/channel.h"
|
75
100
|
#include "src/core/lib/transport/connectivity_state.h"
|
@@ -269,7 +294,6 @@ class RlsLb : public LoadBalancingPolicy {
|
|
269
294
|
//
|
270
295
|
// Both methods grab the data they need from the parent object.
|
271
296
|
void StartUpdate() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&RlsLb::mu_);
|
272
|
-
// Does not take ownership of channel_args.
|
273
297
|
void MaybeFinishUpdate() ABSL_LOCKS_EXCLUDED(&RlsLb::mu_);
|
274
298
|
|
275
299
|
void ExitIdleLocked() {
|
@@ -668,6 +692,7 @@ class RlsLb : public LoadBalancingPolicy {
|
|
668
692
|
// Mutex to guard LB policy state that is accessed by the picker.
|
669
693
|
Mutex mu_;
|
670
694
|
bool is_shutdown_ ABSL_GUARDED_BY(mu_) = false;
|
695
|
+
bool update_in_progress_ = false;
|
671
696
|
Cache cache_ ABSL_GUARDED_BY(mu_);
|
672
697
|
// Maps an RLS request key to an RlsRequest object that represents a pending
|
673
698
|
// RLS request.
|
@@ -1568,7 +1593,8 @@ RlsLb::RlsChannel::RlsChannel(RefCountedPtr<RlsLb> lb_policy)
|
|
1568
1593
|
parent_channelz_node_ = parent_channelz_node->Ref();
|
1569
1594
|
}
|
1570
1595
|
// Start connectivity watch.
|
1571
|
-
ClientChannel* client_channel =
|
1596
|
+
ClientChannel* client_channel =
|
1597
|
+
ClientChannel::GetFromChannel(Channel::FromC(channel_));
|
1572
1598
|
GPR_ASSERT(client_channel != nullptr);
|
1573
1599
|
watcher_ = new StateWatcher(Ref(DEBUG_LOCATION, "StateWatcher"));
|
1574
1600
|
client_channel->AddConnectivityWatcher(
|
@@ -1593,7 +1619,8 @@ void RlsLb::RlsChannel::Orphan() {
|
|
1593
1619
|
}
|
1594
1620
|
// Stop connectivity watch.
|
1595
1621
|
if (watcher_ != nullptr) {
|
1596
|
-
ClientChannel* client_channel =
|
1622
|
+
ClientChannel* client_channel =
|
1623
|
+
ClientChannel::GetFromChannel(Channel::FromC(channel_));
|
1597
1624
|
GPR_ASSERT(client_channel != nullptr);
|
1598
1625
|
client_channel->RemoveConnectivityWatcher(watcher_);
|
1599
1626
|
watcher_ = nullptr;
|
@@ -1882,6 +1909,7 @@ void RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1882
1909
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_rls_trace)) {
|
1883
1910
|
gpr_log(GPR_INFO, "[rlslb %p] policy updated", this);
|
1884
1911
|
}
|
1912
|
+
update_in_progress_ = true;
|
1885
1913
|
// Swap out config.
|
1886
1914
|
RefCountedPtr<RlsLbConfig> old_config = std::move(config_);
|
1887
1915
|
config_ = std::move(args.config);
|
@@ -1984,6 +2012,7 @@ void RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1984
2012
|
}
|
1985
2013
|
default_child_policy_->MaybeFinishUpdate();
|
1986
2014
|
}
|
2015
|
+
update_in_progress_ = false;
|
1987
2016
|
// In principle, we need to update the picker here only if the config
|
1988
2017
|
// fields used by the picker have changed. However, it seems fragile
|
1989
2018
|
// to check individual fields, since the picker logic could change in
|
@@ -2051,6 +2080,12 @@ void RlsLb::UpdatePickerCallback(void* arg, grpc_error_handle /*error*/) {
|
|
2051
2080
|
}
|
2052
2081
|
|
2053
2082
|
void RlsLb::UpdatePickerLocked() {
|
2083
|
+
// If we're in the process of propagating an update from our parent to
|
2084
|
+
// our children, ignore any updates that come from the children. We
|
2085
|
+
// will instead return a new picker once the update has been seen by
|
2086
|
+
// all children. This avoids unnecessary picker churn while an update
|
2087
|
+
// is being propagated to our children.
|
2088
|
+
if (update_in_progress_) return;
|
2054
2089
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_rls_trace)) {
|
2055
2090
|
gpr_log(GPR_INFO, "[rlslb %p] updating picker", this);
|
2056
2091
|
}
|