grpc 1.63.0 → 1.65.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +105 -103
- data/include/grpc/credentials.h +1222 -0
- data/include/grpc/event_engine/event_engine.h +13 -6
- data/include/grpc/grpc.h +7 -0
- data/include/grpc/grpc_crl_provider.h +1 -0
- data/include/grpc/grpc_security.h +0 -1171
- data/include/grpc/impl/channel_arg_names.h +7 -6
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/passive_listener.h +62 -0
- data/include/grpc/support/log.h +7 -17
- data/include/grpc/support/port_platform.h +3 -0
- data/src/core/{lib/channel → channelz}/channel_trace.cc +57 -63
- data/src/core/{lib/channel → channelz}/channel_trace.h +22 -20
- data/src/core/{lib/channel → channelz}/channelz.cc +71 -9
- data/src/core/{lib/channel → channelz}/channelz.h +52 -13
- data/src/core/{lib/channel → channelz}/channelz_registry.cc +11 -9
- data/src/core/{lib/channel → channelz}/channelz_registry.h +6 -6
- data/src/core/client_channel/backup_poller.cc +4 -5
- data/src/core/client_channel/client_channel.cc +1324 -0
- data/src/core/client_channel/client_channel.h +243 -0
- data/src/core/client_channel/client_channel_filter.cc +312 -759
- data/src/core/client_channel/client_channel_filter.h +13 -68
- data/src/core/client_channel/client_channel_internal.h +19 -7
- data/src/core/client_channel/client_channel_plugin.cc +1 -14
- data/src/core/client_channel/client_channel_service_config.h +4 -4
- data/src/core/client_channel/config_selector.cc +1 -1
- data/src/core/client_channel/config_selector.h +5 -4
- data/src/core/client_channel/connector.h +1 -1
- data/src/core/client_channel/dynamic_filters.cc +6 -5
- data/src/core/client_channel/dynamic_filters.h +1 -3
- data/src/core/client_channel/load_balanced_call_destination.cc +336 -0
- data/src/core/client_channel/load_balanced_call_destination.h +49 -0
- data/src/core/client_channel/local_subchannel_pool.cc +5 -3
- data/src/core/client_channel/retry_filter.cc +3 -10
- data/src/core/client_channel/retry_filter.h +5 -9
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +70 -76
- data/src/core/client_channel/retry_filter_legacy_call_data.h +0 -2
- data/src/core/client_channel/retry_service_config.cc +4 -5
- data/src/core/client_channel/retry_service_config.h +3 -3
- data/src/core/client_channel/subchannel.cc +241 -129
- data/src/core/client_channel/subchannel.h +31 -19
- data/src/core/client_channel/subchannel_pool_interface.cc +0 -2
- data/src/core/client_channel/subchannel_pool_interface.h +2 -4
- data/src/core/client_channel/subchannel_stream_client.cc +41 -52
- data/src/core/client_channel/subchannel_stream_client.h +2 -4
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +11 -13
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +3 -2
- data/src/core/ext/filters/backend_metrics/backend_metric_provider.h +7 -0
- data/src/core/ext/filters/census/grpc_context.cc +2 -4
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +16 -15
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.h +12 -11
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +11 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +5 -4
- 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 +6 -4
- data/src/core/ext/filters/http/client/http_client_filter.h +6 -5
- data/src/core/ext/filters/http/client_authority_filter.cc +5 -3
- data/src/core/ext/filters/http/client_authority_filter.h +6 -4
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +19 -23
- data/src/core/ext/filters/http/message_compress/compression_filter.h +10 -8
- data/src/core/ext/filters/http/server/http_server_filter.cc +4 -4
- data/src/core/ext/filters/http/server/http_server_filter.h +6 -5
- data/src/core/ext/filters/message_size/message_size_filter.cc +16 -28
- data/src/core/ext/filters/message_size/message_size_filter.h +14 -12
- data/src/core/ext/filters/rbac/rbac_filter.cc +13 -11
- data/src/core/ext/filters/rbac/rbac_filter.h +6 -5
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +1 -1
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +14 -18
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +4 -2
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +3 -3
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +5 -4
- data/src/core/ext/transport/chttp2/alpn/alpn.h +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +23 -38
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +2 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +233 -158
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +36 -3
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +1 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +8 -7
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +190 -165
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +10 -11
- data/src/core/ext/transport/chttp2/transport/context_list_entry.h +3 -3
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +6 -8
- data/src/core/ext/transport/chttp2/transport/flow_control.h +4 -6
- data/src/core/ext/transport/chttp2/transport/frame.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +7 -9
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +4 -5
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_constants.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +9 -7
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +10 -4
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +10 -9
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +29 -31
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +8 -13
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +3 -3
- data/src/core/ext/transport/chttp2/transport/huffsyms.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +31 -23
- data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +29 -39
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +2 -2
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +3 -5
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.h +1 -4
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +30 -15
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +7 -6
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +10 -11
- data/src/core/ext/transport/chttp2/transport/varint.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/varint.h +4 -3
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/write_size_policy.h +2 -2
- data/src/core/ext/transport/chttp2/transport/writing.cc +59 -47
- data/src/core/ext/transport/inproc/inproc_transport.cc +65 -41
- data/src/core/ext/transport/inproc/inproc_transport.h +2 -5
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +20 -23
- data/src/core/ext/transport/inproc/legacy_inproc_transport.h +1 -4
- data/src/core/{lib/transport → handshaker/endpoint_info}/endpoint_info_handshaker.cc +6 -6
- data/src/core/{lib/transport → handshaker/endpoint_info}/endpoint_info_handshaker.h +3 -3
- data/src/core/{lib/transport → handshaker}/handshaker.cc +14 -20
- data/src/core/{lib/transport → handshaker}/handshaker.h +4 -5
- data/src/core/{lib/transport → handshaker}/handshaker_factory.h +19 -3
- data/src/core/{lib/transport → handshaker}/handshaker_registry.cc +3 -3
- data/src/core/{lib/transport → handshaker}/handshaker_registry.h +6 -6
- data/src/core/{lib/transport → handshaker/http_connect}/http_connect_handshaker.cc +16 -25
- data/src/core/{lib/transport → handshaker/http_connect}/http_connect_handshaker.h +3 -3
- data/src/core/{client_channel → handshaker/http_connect}/http_proxy_mapper.cc +16 -18
- data/src/core/{client_channel → handshaker/http_connect}/http_proxy_mapper.h +6 -6
- data/src/core/{lib/handshaker → handshaker}/proxy_mapper.h +5 -5
- data/src/core/{lib/handshaker → handshaker}/proxy_mapper_registry.cc +3 -3
- data/src/core/{lib/handshaker → handshaker}/proxy_mapper_registry.h +6 -6
- data/src/core/{lib/security/transport → handshaker/security}/secure_endpoint.cc +42 -36
- data/src/core/{lib/security/transport → handshaker/security}/secure_endpoint.h +4 -7
- data/src/core/{lib/security/transport → handshaker/security}/security_handshaker.cc +35 -47
- data/src/core/{lib/security/transport → handshaker/security}/security_handshaker.h +5 -6
- data/src/core/{lib/transport → handshaker/tcp_connect}/tcp_connect_handshaker.cc +10 -9
- data/src/core/{lib/transport → handshaker/tcp_connect}/tcp_connect_handshaker.h +3 -3
- data/src/core/lib/address_utils/parse_address.cc +30 -40
- data/src/core/lib/address_utils/parse_address.h +2 -2
- data/src/core/lib/address_utils/sockaddr_utils.cc +20 -15
- data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
- data/src/core/lib/avl/avl.h +3 -3
- data/src/core/lib/backoff/backoff.cc +2 -2
- data/src/core/lib/backoff/backoff.h +2 -2
- data/src/core/lib/backoff/random_early_detection.cc +2 -2
- data/src/core/lib/backoff/random_early_detection.h +2 -2
- data/src/core/lib/channel/call_finalization.h +2 -2
- data/src/core/lib/channel/channel_args.cc +17 -21
- data/src/core/lib/channel/channel_args.h +20 -10
- data/src/core/lib/channel/channel_args_preconditioning.cc +2 -2
- data/src/core/lib/channel/channel_args_preconditioning.h +1 -2
- data/src/core/lib/channel/channel_stack.cc +13 -70
- data/src/core/lib/channel/channel_stack.h +14 -39
- data/src/core/lib/channel/channel_stack_builder.cc +2 -2
- data/src/core/lib/channel/channel_stack_builder.h +2 -7
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -150
- data/src/core/lib/channel/channel_stack_builder_impl.h +2 -4
- data/src/core/lib/channel/connected_channel.cc +40 -694
- data/src/core/lib/channel/promise_based_filter.cc +111 -122
- data/src/core/lib/channel/promise_based_filter.h +219 -531
- data/src/core/lib/channel/status_util.cc +3 -3
- data/src/core/lib/channel/status_util.h +1 -2
- data/src/core/lib/compression/compression.cc +2 -3
- data/src/core/lib/compression/compression_internal.cc +3 -3
- data/src/core/lib/compression/compression_internal.h +1 -2
- data/src/core/lib/compression/message_compress.cc +15 -14
- data/src/core/lib/compression/message_compress.h +1 -2
- data/src/core/lib/config/config_vars.cc +5 -10
- data/src/core/lib/config/config_vars.h +3 -7
- data/src/core/lib/config/config_vars_non_generated.cc +2 -2
- data/src/core/lib/config/core_configuration.cc +9 -8
- data/src/core/lib/config/core_configuration.h +8 -8
- data/src/core/lib/config/load_config.cc +4 -4
- data/src/core/lib/config/load_config.h +2 -2
- data/src/core/lib/debug/event_log.cc +3 -3
- data/src/core/lib/debug/event_log.h +3 -3
- data/src/core/lib/debug/trace.cc +44 -61
- data/src/core/lib/debug/trace.h +2 -97
- data/src/core/lib/debug/trace_flags.cc +255 -0
- data/src/core/lib/debug/trace_flags.h +133 -0
- data/src/core/lib/debug/trace_impl.h +115 -0
- data/src/core/lib/event_engine/ares_resolver.cc +23 -26
- data/src/core/lib/event_engine/ares_resolver.h +3 -5
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +4 -2
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +3 -3
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +19 -23
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -1
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +1 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +1 -2
- data/src/core/lib/event_engine/common_closures.h +1 -2
- data/src/core/lib/event_engine/default_event_engine.cc +1 -2
- data/src/core/lib/event_engine/default_event_engine.h +1 -2
- data/src/core/lib/event_engine/default_event_engine_factory.cc +1 -2
- data/src/core/lib/event_engine/default_event_engine_factory.h +1 -2
- data/src/core/lib/event_engine/event_engine.cc +29 -5
- data/src/core/lib/event_engine/event_engine_context.h +1 -2
- data/src/core/lib/event_engine/extensions/can_track_errors.h +2 -2
- data/src/core/lib/event_engine/extensions/chaotic_good_extension.h +2 -2
- data/src/core/lib/event_engine/extensions/supports_fd.h +8 -2
- data/src/core/lib/event_engine/extensions/tcp_trace.h +43 -0
- data/src/core/lib/event_engine/forkable.cc +11 -11
- data/src/core/lib/event_engine/forkable.h +1 -13
- data/src/core/lib/event_engine/grpc_polled_fd.h +1 -2
- data/src/core/lib/event_engine/handle_containers.h +1 -2
- data/src/core/lib/event_engine/memory_allocator_factory.h +1 -2
- data/src/core/lib/event_engine/poller.h +1 -2
- data/src/core/lib/event_engine/posix.h +1 -2
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +19 -19
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +1 -2
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +11 -11
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +1 -2
- data/src/core/lib/event_engine/posix_engine/event_poller.h +1 -2
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +2 -2
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +1 -2
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +2 -2
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +2 -2
- data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +43 -58
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +14 -13
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +34 -17
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +3 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +1 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +17 -18
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +1 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +24 -28
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +1 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +22 -20
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer.cc +2 -3
- data/src/core/lib/event_engine/posix_engine/timer.h +1 -2
- data/src/core/lib/event_engine/posix_engine/timer_heap.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/timer_heap.h +2 -2
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +9 -11
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +1 -2
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +1 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +2 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +2 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +2 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +2 -2
- data/src/core/lib/event_engine/query_extensions.h +3 -2
- data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +1 -2
- data/src/core/lib/event_engine/resolved_address.cc +5 -4
- data/src/core/lib/event_engine/resolved_address_internal.h +1 -2
- data/src/core/lib/event_engine/shim.cc +3 -3
- data/src/core/lib/event_engine/slice.cc +4 -3
- data/src/core/lib/event_engine/slice_buffer.cc +1 -2
- data/src/core/lib/event_engine/tcp_socket_utils.cc +18 -16
- data/src/core/lib/event_engine/tcp_socket_utils.h +1 -2
- data/src/core/lib/event_engine/thread_local.cc +2 -2
- data/src/core/lib/event_engine/thread_local.h +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +1 -2
- data/src/core/lib/event_engine/thread_pool/thread_count.h +2 -3
- data/src/core/lib/event_engine/thread_pool/thread_pool.h +1 -2
- data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +2 -2
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +27 -28
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +4 -8
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +16 -15
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +5 -5
- data/src/core/lib/event_engine/time_util.cc +1 -2
- data/src/core/lib/event_engine/time_util.h +1 -2
- data/src/core/lib/event_engine/trace.h +7 -19
- data/src/core/lib/event_engine/utils.cc +1 -2
- data/src/core/lib/event_engine/utils.h +1 -2
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -30
- data/src/core/lib/event_engine/windows/iocp.cc +10 -8
- data/src/core/lib/event_engine/windows/iocp.h +1 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +32 -22
- data/src/core/lib/event_engine/windows/win_socket.h +4 -5
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +24 -25
- data/src/core/lib/event_engine/windows/windows_engine.cc +205 -90
- data/src/core/lib/event_engine/windows/windows_engine.h +136 -25
- data/src/core/lib/event_engine/windows/windows_listener.cc +19 -29
- data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +2 -2
- data/src/core/lib/event_engine/work_queue/basic_work_queue.h +1 -2
- data/src/core/lib/event_engine/work_queue/work_queue.h +1 -2
- data/src/core/lib/experiments/config.cc +16 -14
- data/src/core/lib/experiments/config.h +2 -2
- data/src/core/lib/experiments/experiments.cc +57 -158
- data/src/core/lib/experiments/experiments.h +35 -52
- data/src/core/lib/gprpp/atomic_utils.h +2 -2
- data/src/core/lib/gprpp/bitset.h +3 -3
- data/src/core/lib/gprpp/chunked_vector.h +6 -5
- data/src/core/lib/gprpp/construct_destruct.h +2 -2
- data/src/core/lib/gprpp/crash.cc +3 -5
- data/src/core/lib/gprpp/crash.h +2 -2
- data/src/core/lib/gprpp/debug_location.h +2 -2
- data/src/core/lib/gprpp/directory_reader.h +2 -2
- data/src/core/lib/gprpp/down_cast.h +3 -3
- data/src/core/lib/gprpp/dual_ref_counted.h +54 -41
- data/src/core/lib/gprpp/dump_args.cc +54 -0
- data/src/core/lib/gprpp/dump_args.h +69 -0
- data/src/core/lib/gprpp/env.h +2 -2
- data/src/core/lib/gprpp/examine_stack.cc +2 -2
- data/src/core/lib/gprpp/examine_stack.h +2 -2
- data/src/core/lib/gprpp/fork.cc +1 -2
- data/src/core/lib/gprpp/fork.h +2 -2
- data/src/core/lib/gprpp/glob.cc +70 -0
- data/src/core/lib/gprpp/glob.h +29 -0
- data/src/core/lib/gprpp/host_port.cc +6 -4
- data/src/core/lib/gprpp/host_port.h +2 -2
- data/src/core/lib/gprpp/linux/env.cc +2 -2
- data/src/core/lib/gprpp/load_file.cc +1 -2
- data/src/core/lib/gprpp/load_file.h +2 -2
- data/src/core/lib/gprpp/manual_constructor.h +2 -2
- data/src/core/lib/gprpp/match.h +2 -2
- data/src/core/lib/gprpp/memory.h +1 -2
- data/src/core/lib/gprpp/mpscq.cc +2 -2
- data/src/core/lib/gprpp/mpscq.h +5 -4
- data/src/core/lib/gprpp/no_destruct.h +2 -2
- data/src/core/lib/gprpp/notification.h +2 -2
- data/src/core/lib/gprpp/orphanable.h +2 -2
- data/src/core/lib/gprpp/overload.h +2 -2
- data/src/core/lib/gprpp/per_cpu.cc +2 -3
- data/src/core/lib/gprpp/per_cpu.h +1 -2
- data/src/core/lib/gprpp/posix/directory_reader.cc +2 -2
- data/src/core/lib/gprpp/posix/stat.cc +8 -7
- data/src/core/lib/gprpp/posix/thd.cc +18 -19
- data/src/core/lib/gprpp/ref_counted.h +35 -26
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -2
- data/src/core/lib/gprpp/ref_counted_string.cc +1 -2
- data/src/core/lib/gprpp/ref_counted_string.h +2 -2
- data/src/core/lib/gprpp/single_set_ptr.h +9 -6
- data/src/core/lib/gprpp/sorted_pack.h +2 -2
- data/src/core/lib/gprpp/stat.h +2 -2
- data/src/core/lib/gprpp/status_helper.cc +14 -33
- data/src/core/lib/gprpp/status_helper.h +5 -33
- data/src/core/lib/gprpp/strerror.cc +2 -2
- data/src/core/lib/gprpp/strerror.h +2 -2
- data/src/core/lib/gprpp/sync.h +5 -5
- data/src/core/lib/gprpp/table.h +2 -2
- data/src/core/lib/gprpp/tchar.cc +2 -2
- data/src/core/lib/gprpp/thd.h +7 -7
- data/src/core/lib/gprpp/time.cc +9 -10
- data/src/core/lib/gprpp/time.h +4 -4
- data/src/core/lib/gprpp/time_averaged_stats.cc +2 -2
- data/src/core/lib/gprpp/time_util.cc +5 -4
- data/src/core/lib/gprpp/time_util.h +1 -2
- data/src/core/lib/gprpp/unique_type_name.h +3 -3
- data/src/core/lib/gprpp/uuid_v4.cc +2 -2
- data/src/core/lib/gprpp/uuid_v4.h +2 -2
- data/src/core/lib/gprpp/validation_errors.cc +12 -3
- data/src/core/lib/gprpp/validation_errors.h +13 -2
- data/src/core/lib/gprpp/windows/stat.cc +6 -5
- data/src/core/lib/gprpp/windows/thd.cc +7 -4
- data/src/core/lib/gprpp/work_serializer.cc +53 -62
- data/src/core/lib/gprpp/work_serializer.h +1 -2
- data/src/core/lib/iomgr/buffer_list.cc +5 -4
- data/src/core/lib/iomgr/buffer_list.h +1 -2
- data/src/core/lib/iomgr/call_combiner.cc +23 -31
- data/src/core/lib/iomgr/call_combiner.h +2 -5
- data/src/core/lib/iomgr/cfstream_handle.cc +4 -6
- data/src/core/lib/iomgr/closure.cc +2 -2
- data/src/core/lib/iomgr/closure.h +6 -7
- data/src/core/lib/iomgr/combiner.cc +13 -14
- data/src/core/lib/iomgr/combiner.h +1 -4
- data/src/core/lib/iomgr/endpoint.cc +1 -7
- data/src/core/lib/iomgr/endpoint.h +1 -4
- data/src/core/lib/iomgr/endpoint_cfstream.cc +26 -46
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +6 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -15
- data/src/core/lib/iomgr/error.cc +16 -24
- data/src/core/lib/iomgr/error.h +4 -4
- data/src/core/lib/iomgr/ev_apple.cc +3 -5
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +58 -56
- data/src/core/lib/iomgr/ev_poll_posix.cc +47 -38
- data/src/core/lib/iomgr/ev_posix.cc +9 -11
- data/src/core/lib/iomgr/ev_posix.h +11 -8
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +3 -4
- data/src/core/lib/iomgr/event_engine_shims/closure.h +1 -2
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +17 -31
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.h +1 -2
- data/src/core/lib/iomgr/exec_ctx.cc +7 -7
- data/src/core/lib/iomgr/exec_ctx.h +7 -5
- data/src/core/lib/iomgr/executor.cc +13 -23
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/fork_posix.cc +8 -10
- data/src/core/lib/iomgr/fork_windows.cc +3 -1
- data/src/core/lib/iomgr/grpc_if_nametoindex.h +2 -2
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +2 -3
- data/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +3 -5
- data/src/core/lib/iomgr/internal_errqueue.cc +5 -4
- data/src/core/lib/iomgr/iocp_windows.cc +13 -9
- data/src/core/lib/iomgr/iocp_windows.h +0 -1
- data/src/core/lib/iomgr/iomgr.cc +14 -19
- data/src/core/lib/iomgr/iomgr.h +2 -2
- data/src/core/lib/iomgr/iomgr_internal.cc +2 -2
- data/src/core/lib/iomgr/iomgr_internal.h +2 -2
- data/src/core/lib/iomgr/iomgr_windows.cc +4 -2
- data/src/core/lib/iomgr/lockfree_event.cc +7 -8
- data/src/core/lib/iomgr/lockfree_event.h +1 -2
- data/src/core/lib/iomgr/polling_entity.cc +5 -5
- data/src/core/lib/iomgr/pollset.cc +2 -2
- data/src/core/lib/iomgr/pollset.h +0 -3
- data/src/core/lib/iomgr/pollset_set.cc +2 -2
- data/src/core/lib/iomgr/pollset_set_windows.cc +2 -2
- data/src/core/lib/iomgr/pollset_windows.cc +0 -2
- data/src/core/lib/iomgr/pollset_windows.h +0 -1
- data/src/core/lib/iomgr/python_util.h +1 -2
- data/src/core/lib/iomgr/resolve_address.cc +1 -2
- data/src/core/lib/iomgr/resolve_address.h +1 -2
- data/src/core/lib/iomgr/resolve_address_impl.h +2 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +7 -14
- data/src/core/lib/iomgr/resolve_address_posix.h +2 -2
- data/src/core/lib/iomgr/resolve_address_windows.cc +1 -1
- data/src/core/lib/iomgr/resolve_address_windows.h +2 -2
- data/src/core/lib/iomgr/resolved_address.h +2 -2
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +3 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -2
- data/src/core/lib/iomgr/socket_mutator.cc +2 -3
- data/src/core/lib/iomgr/socket_mutator.h +1 -2
- data/src/core/lib/iomgr/socket_utils.h +2 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +28 -33
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -2
- data/src/core/lib/iomgr/socket_utils_posix.h +1 -2
- data/src/core/lib/iomgr/socket_windows.cc +8 -9
- data/src/core/lib/iomgr/tcp_client.cc +2 -2
- data/src/core/lib/iomgr/tcp_client.h +1 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +3 -5
- data/src/core/lib/iomgr/tcp_client_posix.cc +14 -19
- data/src/core/lib/iomgr/tcp_client_windows.cc +9 -9
- data/src/core/lib/iomgr/tcp_posix.cc +99 -125
- data/src/core/lib/iomgr/tcp_posix.h +0 -2
- data/src/core/lib/iomgr/tcp_server.cc +2 -2
- data/src/core/lib/iomgr/tcp_server.h +1 -2
- data/src/core/lib/iomgr/tcp_server_posix.cc +35 -38
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +10 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +9 -8
- data/src/core/lib/iomgr/tcp_server_windows.cc +25 -30
- data/src/core/lib/iomgr/tcp_windows.cc +33 -47
- data/src/core/lib/iomgr/timer.cc +2 -2
- data/src/core/lib/iomgr/timer.h +1 -2
- data/src/core/lib/iomgr/timer_generic.cc +20 -23
- data/src/core/lib/iomgr/timer_generic.h +0 -1
- data/src/core/lib/iomgr/timer_heap.cc +2 -3
- data/src/core/lib/iomgr/timer_manager.cc +21 -33
- data/src/core/lib/iomgr/timer_manager.h +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +3 -2
- data/src/core/lib/iomgr/unix_sockets_posix.h +1 -2
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +3 -1
- data/src/core/lib/iomgr/vsock.cc +3 -3
- data/src/core/lib/iomgr/vsock.h +1 -2
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +3 -3
- data/src/core/lib/matchers/matchers.cc +2 -2
- data/src/core/lib/matchers/matchers.h +2 -2
- data/src/core/lib/promise/activity.cc +4 -3
- data/src/core/lib/promise/activity.h +34 -11
- data/src/core/lib/promise/all_ok.h +2 -2
- data/src/core/lib/promise/arena_promise.h +2 -2
- data/src/core/lib/promise/cancel_callback.h +24 -0
- data/src/core/lib/promise/context.h +14 -3
- data/src/core/lib/promise/detail/basic_seq.h +1 -2
- data/src/core/lib/promise/detail/join_state.h +365 -408
- data/src/core/lib/promise/detail/promise_factory.h +2 -2
- data/src/core/lib/promise/detail/promise_like.h +15 -8
- data/src/core/lib/promise/detail/seq_state.h +1192 -1192
- data/src/core/lib/promise/detail/status.h +4 -3
- data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +2 -2
- data/src/core/lib/promise/for_each.h +91 -30
- data/src/core/lib/promise/if.h +2 -2
- data/src/core/lib/promise/interceptor_list.h +9 -10
- data/src/core/lib/promise/latch.h +17 -17
- data/src/core/lib/promise/loop.h +2 -2
- data/src/core/lib/promise/map.h +19 -2
- data/src/core/lib/promise/observable.h +182 -0
- data/src/core/lib/promise/party.cc +22 -23
- data/src/core/lib/promise/party.h +19 -17
- data/src/core/lib/promise/pipe.h +31 -50
- data/src/core/lib/promise/poll.h +6 -5
- data/src/core/lib/promise/prioritized_race.h +2 -2
- data/src/core/lib/promise/promise.h +3 -2
- data/src/core/lib/promise/race.h +2 -2
- data/src/core/lib/promise/seq.h +2 -2
- data/src/core/lib/promise/sleep.cc +1 -2
- data/src/core/lib/promise/sleep.h +1 -2
- data/src/core/lib/promise/status_flag.h +10 -8
- data/src/core/lib/promise/try_join.h +4 -3
- data/src/core/lib/promise/try_seq.h +4 -3
- data/src/core/lib/resource_quota/api.cc +1 -2
- data/src/core/lib/resource_quota/api.h +1 -2
- data/src/core/lib/resource_quota/arena.cc +57 -81
- data/src/core/lib/resource_quota/arena.h +119 -211
- data/src/core/lib/resource_quota/connection_quota.cc +8 -9
- data/src/core/lib/resource_quota/connection_quota.h +2 -2
- data/src/core/lib/resource_quota/memory_quota.cc +20 -21
- data/src/core/lib/resource_quota/memory_quota.h +6 -7
- data/src/core/lib/resource_quota/periodic_update.cc +3 -3
- data/src/core/lib/resource_quota/periodic_update.h +2 -2
- data/src/core/lib/resource_quota/resource_quota.cc +2 -2
- data/src/core/lib/resource_quota/resource_quota.h +2 -3
- data/src/core/lib/resource_quota/thread_quota.cc +4 -3
- data/src/core/lib/resource_quota/thread_quota.h +2 -2
- data/src/core/lib/security/authorization/audit_logging.cc +6 -6
- data/src/core/lib/security/authorization/audit_logging.h +1 -2
- data/src/core/lib/security/authorization/authorization_engine.h +2 -2
- data/src/core/lib/security/authorization/authorization_policy_provider.h +2 -3
- data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +2 -3
- data/src/core/lib/security/authorization/evaluate_args.cc +8 -11
- data/src/core/lib/security/authorization/evaluate_args.h +1 -2
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +4 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -2
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +9 -11
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +8 -8
- data/src/core/lib/security/authorization/matchers.cc +4 -5
- data/src/core/lib/security/authorization/matchers.h +2 -2
- data/src/core/lib/security/authorization/rbac_policy.cc +2 -2
- data/src/core/lib/security/authorization/rbac_policy.h +1 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +4 -3
- data/src/core/lib/security/authorization/stdout_logger.h +1 -2
- data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +4 -4
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +6 -6
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +2 -2
- data/src/core/lib/security/context/security_context.cc +17 -16
- data/src/core/lib/security/context/security_context.h +33 -10
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.h +3 -3
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +4 -3
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -3
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +5 -6
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc +4 -5
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +2 -2
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +1 -2
- data/src/core/lib/security/credentials/call_creds_util.cc +3 -3
- data/src/core/lib/security/credentials/call_creds_util.h +2 -2
- data/src/core/lib/security/credentials/channel_creds_registry.h +4 -4
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +7 -5
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +9 -8
- data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -3
- data/src/core/lib/security/credentials/credentials.cc +10 -9
- data/src/core/lib/security/credentials/credentials.h +5 -4
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +9 -8
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +4 -4
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +2 -2
- data/src/core/lib/security/credentials/external/aws_request_signer.h +2 -2
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +16 -17
- data/src/core/lib/security/credentials/external/external_account_credentials.h +5 -5
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +3 -4
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +2 -2
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +8 -7
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.h +3 -3
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +4 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +19 -18
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +5 -5
- data/src/core/lib/security/credentials/iam/iam_credentials.h +3 -3
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +2 -2
- data/src/core/lib/security/credentials/insecure/insecure_credentials.h +2 -2
- data/src/core/lib/security/credentials/jwt/json_token.cc +19 -19
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +10 -8
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +3 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +65 -69
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/local/local_credentials.cc +1 -2
- data/src/core/lib/security/credentials/local/local_credentials.h +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +21 -19
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +6 -6
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +9 -10
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +28 -34
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +6 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +26 -25
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +2 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_match.cc +2 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +28 -36
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +5 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -22
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +1 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +5 -7
- data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -2
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +15 -18
- data/src/core/lib/security/credentials/tls/tls_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +5 -6
- data/src/core/lib/security/credentials/tls/tls_utils.h +1 -2
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +8 -8
- data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +27 -30
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +2 -2
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +20 -17
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +2 -2
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +6 -5
- 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 +1 -2
- data/src/core/lib/security/security_connector/load_system_roots_supported.cc +8 -8
- data/src/core/lib/security/security_connector/load_system_roots_supported.h +1 -2
- data/src/core/lib/security/security_connector/load_system_roots_windows.cc +1 -1
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +19 -23
- data/src/core/lib/security/security_connector/local/local_security_connector.h +2 -2
- data/src/core/lib/security/security_connector/security_connector.cc +8 -10
- data/src/core/lib/security/security_connector/security_connector.h +4 -6
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +23 -25
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.cc +29 -30
- data/src/core/lib/security/security_connector/ssl_utils.h +1 -2
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +42 -53
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +3 -3
- data/src/core/lib/security/transport/auth_filters.h +14 -13
- data/src/core/lib/security/transport/client_auth_filter.cc +13 -18
- data/src/core/lib/security/transport/server_auth_filter.cc +10 -13
- data/src/core/lib/security/util/json_util.cc +1 -2
- data/src/core/lib/security/util/json_util.h +1 -1
- data/src/core/lib/slice/percent_encoding.cc +4 -3
- data/src/core/lib/slice/slice.cc +11 -10
- data/src/core/lib/slice/slice.h +5 -5
- data/src/core/lib/slice/slice_buffer.cc +15 -14
- data/src/core/lib/slice/slice_buffer.h +1 -2
- data/src/core/lib/slice/slice_internal.h +3 -3
- data/src/core/lib/slice/slice_refcount.h +3 -6
- data/src/core/lib/slice/slice_string_helpers.cc +3 -3
- data/src/core/lib/slice/slice_string_helpers.h +1 -2
- data/src/core/lib/surface/api_trace.h +2 -5
- data/src/core/lib/surface/byte_buffer.cc +1 -2
- data/src/core/lib/surface/byte_buffer_reader.cc +4 -3
- data/src/core/lib/surface/call.cc +102 -3899
- data/src/core/lib/surface/call.h +158 -90
- data/src/core/lib/surface/call_details.cc +1 -2
- data/src/core/lib/surface/call_log_batch.cc +2 -3
- data/src/core/lib/surface/call_test_only.h +1 -2
- data/src/core/lib/surface/call_utils.cc +276 -0
- data/src/core/lib/surface/call_utils.h +449 -0
- data/src/core/lib/surface/channel.cc +17 -11
- data/src/core/lib/surface/channel.h +12 -10
- data/src/core/lib/surface/channel_create.cc +18 -9
- data/src/core/lib/surface/channel_create.h +5 -4
- data/src/core/lib/surface/channel_init.cc +27 -83
- data/src/core/lib/surface/channel_init.h +27 -100
- data/src/core/lib/surface/channel_stack_type.cc +2 -2
- data/src/core/lib/surface/client_call.cc +419 -0
- data/src/core/lib/surface/client_call.h +180 -0
- data/src/core/lib/surface/completion_queue.cc +45 -51
- data/src/core/lib/surface/completion_queue.h +1 -10
- data/src/core/lib/surface/completion_queue_factory.cc +9 -8
- data/src/core/lib/surface/completion_queue_factory.h +1 -2
- data/src/core/lib/surface/event_string.cc +2 -2
- data/src/core/lib/surface/event_string.h +1 -2
- data/src/core/lib/surface/filter_stack_call.cc +1157 -0
- data/src/core/lib/surface/filter_stack_call.h +369 -0
- data/src/core/lib/surface/init.cc +8 -8
- data/src/core/lib/surface/init_internally.cc +2 -2
- data/src/core/lib/surface/lame_client.cc +10 -13
- data/src/core/lib/surface/lame_client.h +6 -11
- data/src/core/lib/surface/legacy_channel.cc +52 -39
- data/src/core/lib/surface/legacy_channel.h +11 -21
- data/src/core/lib/surface/metadata_array.cc +1 -2
- data/src/core/lib/surface/server_call.cc +222 -0
- data/src/core/lib/surface/server_call.h +167 -0
- data/src/core/lib/surface/validate_metadata.cc +1 -2
- data/src/core/lib/surface/validate_metadata.h +3 -3
- data/src/core/lib/surface/version.cc +3 -4
- data/src/core/lib/transport/bdp_estimator.cc +7 -7
- data/src/core/lib/transport/bdp_estimator.h +6 -8
- data/src/core/lib/transport/{call_size_estimator.cc → call_arena_allocator.cc} +3 -3
- data/src/core/lib/transport/{call_size_estimator.h → call_arena_allocator.h} +29 -6
- data/src/core/lib/transport/call_destination.h +76 -0
- data/src/core/lib/transport/call_filters.cc +54 -21
- data/src/core/lib/transport/call_filters.h +240 -84
- data/src/core/lib/transport/call_final_info.cc +2 -2
- data/src/core/lib/transport/call_final_info.h +1 -2
- data/src/core/lib/transport/call_spine.cc +17 -19
- data/src/core/lib/transport/call_spine.h +238 -215
- data/src/core/lib/transport/connectivity_state.cc +9 -12
- data/src/core/lib/transport/connectivity_state.h +1 -4
- data/src/core/lib/transport/error_utils.cc +1 -2
- data/src/core/lib/transport/error_utils.h +1 -2
- data/src/core/lib/transport/interception_chain.cc +155 -0
- data/src/core/lib/transport/interception_chain.h +236 -0
- data/src/core/lib/transport/message.cc +1 -2
- data/src/core/lib/transport/metadata.cc +2 -2
- data/src/core/lib/transport/metadata_batch.cc +2 -2
- data/src/core/lib/transport/metadata_batch.h +43 -5
- data/src/core/lib/transport/metadata_compression_traits.h +2 -2
- data/src/core/lib/transport/metadata_info.cc +2 -2
- data/src/core/lib/transport/metadata_info.h +1 -1
- data/src/core/lib/transport/parsed_metadata.cc +2 -2
- data/src/core/lib/transport/parsed_metadata.h +1 -2
- data/src/core/lib/transport/simple_slice_based_metadata.h +2 -2
- data/src/core/lib/transport/status_conversion.cc +2 -2
- data/src/core/lib/transport/status_conversion.h +1 -2
- data/src/core/lib/transport/timeout_encoding.cc +5 -5
- data/src/core/lib/transport/timeout_encoding.h +2 -2
- data/src/core/lib/transport/transport.cc +4 -8
- data/src/core/lib/transport/transport.h +80 -74
- data/src/core/lib/transport/transport_op_string.cc +1 -2
- data/src/core/lib/uri/uri_parser.cc +3 -3
- data/src/core/lib/uri/uri_parser.h +2 -2
- data/src/core/load_balancing/address_filtering.cc +2 -2
- data/src/core/load_balancing/address_filtering.h +2 -2
- data/src/core/load_balancing/backend_metric_data.h +2 -2
- data/src/core/load_balancing/backend_metric_parser.cc +2 -2
- data/src/core/load_balancing/backend_metric_parser.h +2 -2
- data/src/core/load_balancing/child_policy_handler.cc +14 -14
- data/src/core/load_balancing/child_policy_handler.h +2 -2
- data/src/core/load_balancing/delegating_helper.h +2 -3
- data/src/core/load_balancing/endpoint_list.cc +11 -13
- data/src/core/load_balancing/endpoint_list.h +16 -10
- data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +29 -30
- data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +20 -8
- data/src/core/load_balancing/grpclb/grpclb.cc +65 -70
- data/src/core/load_balancing/grpclb/grpclb_balancer_addresses.cc +3 -3
- data/src/core/load_balancing/grpclb/grpclb_balancer_addresses.h +1 -2
- data/src/core/load_balancing/grpclb/grpclb_client_stats.cc +1 -2
- data/src/core/load_balancing/grpclb/grpclb_client_stats.h +1 -2
- data/src/core/load_balancing/grpclb/load_balancer_api.cc +4 -6
- data/src/core/load_balancing/grpclb/load_balancer_api.h +2 -3
- data/src/core/load_balancing/health_check_client.cc +14 -18
- data/src/core/load_balancing/health_check_client.h +2 -2
- data/src/core/load_balancing/health_check_client_internal.h +1 -2
- data/src/core/load_balancing/lb_policy.cc +7 -10
- data/src/core/load_balancing/lb_policy.h +20 -5
- data/src/core/load_balancing/lb_policy_factory.h +3 -3
- data/src/core/load_balancing/lb_policy_registry.cc +5 -6
- data/src/core/load_balancing/lb_policy_registry.h +3 -3
- data/src/core/load_balancing/oob_backend_metric.cc +6 -9
- data/src/core/load_balancing/oob_backend_metric.h +2 -2
- data/src/core/load_balancing/oob_backend_metric_internal.h +1 -2
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +36 -38
- data/src/core/load_balancing/outlier_detection/outlier_detection.h +5 -5
- data/src/core/load_balancing/pick_first/pick_first.cc +1141 -156
- data/src/core/load_balancing/priority/priority.cc +41 -38
- data/src/core/load_balancing/ring_hash/ring_hash.cc +45 -30
- data/src/core/load_balancing/ring_hash/ring_hash.h +5 -5
- data/src/core/load_balancing/rls/rls.cc +106 -99
- data/src/core/load_balancing/round_robin/round_robin.cc +43 -35
- data/src/core/load_balancing/subchannel_interface.h +1 -2
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +4 -4
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h +2 -2
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +79 -58
- data/src/core/load_balancing/weighted_target/weighted_target.cc +29 -32
- data/src/core/load_balancing/weighted_target/weighted_target.h +1 -1
- data/src/core/load_balancing/xds/cds.cc +25 -28
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +28 -28
- data/src/core/load_balancing/xds/xds_cluster_manager.cc +17 -20
- data/src/core/load_balancing/xds/xds_override_host.cc +46 -47
- data/src/core/load_balancing/xds/xds_override_host.h +5 -5
- data/src/core/load_balancing/xds/xds_wrr_locality.cc +12 -15
- data/src/core/plugin_registry/grpc_plugin_registry.cc +11 -10
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +1 -2
- data/src/core/resolver/binder/binder_resolver.cc +7 -6
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +8 -8
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.h +2 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -3
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -3
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +36 -35
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +20 -27
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -7
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +1 -1
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -2
- data/src/core/resolver/dns/dns_resolver_plugin.cc +10 -10
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +9 -14
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.h +3 -3
- data/src/core/resolver/dns/event_engine/service_config_helper.cc +7 -7
- data/src/core/resolver/dns/event_engine/service_config_helper.h +2 -2
- data/src/core/resolver/dns/native/dns_resolver.cc +11 -13
- data/src/core/resolver/endpoint_addresses.cc +5 -5
- data/src/core/resolver/endpoint_addresses.h +2 -2
- data/src/core/resolver/fake/fake_resolver.cc +5 -5
- data/src/core/resolver/fake/fake_resolver.h +2 -3
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +22 -23
- data/src/core/resolver/polling_resolver.cc +35 -40
- data/src/core/resolver/polling_resolver.h +1 -2
- data/src/core/resolver/resolver.cc +3 -7
- data/src/core/resolver/resolver.h +2 -4
- data/src/core/resolver/resolver_factory.h +3 -3
- data/src/core/resolver/resolver_registry.cc +11 -13
- data/src/core/resolver/resolver_registry.h +3 -3
- data/src/core/resolver/sockaddr/sockaddr_resolver.cc +5 -6
- data/src/core/resolver/xds/xds_dependency_manager.cc +27 -27
- data/src/core/resolver/xds/xds_dependency_manager.h +7 -7
- data/src/core/resolver/xds/xds_resolver.cc +32 -39
- data/src/core/resolver/xds/xds_resolver_attributes.h +2 -2
- data/src/core/{lib/surface → server}/server.cc +306 -424
- data/src/core/{lib/surface → server}/server.h +43 -26
- data/src/core/{lib/channel → server}/server_call_tracer_filter.cc +16 -20
- data/src/core/{lib/channel → server}/server_call_tracer_filter.h +3 -3
- data/src/core/{ext/filters/server_config_selector → server}/server_config_selector.h +6 -6
- data/src/core/{ext/filters/server_config_selector → server}/server_config_selector_filter.cc +39 -40
- data/src/core/{ext/filters/server_config_selector → server}/server_config_selector_filter.h +3 -3
- data/src/core/{lib/surface → server}/server_interface.h +6 -4
- data/src/core/{ext/xds → server}/xds_channel_stack_modifier.cc +4 -4
- data/src/core/{ext/xds → server}/xds_channel_stack_modifier.h +5 -6
- data/src/core/{ext/xds → server}/xds_server_config_fetcher.cc +24 -26
- data/src/core/service_config/service_config.h +2 -3
- data/src/core/service_config/service_config_call_data.h +15 -13
- data/src/core/service_config/service_config_channel_arg_filter.cc +12 -11
- data/src/core/service_config/service_config_impl.cc +7 -7
- data/src/core/service_config/service_config_impl.h +4 -4
- data/src/core/service_config/service_config_parser.cc +4 -8
- data/src/core/service_config/service_config_parser.h +3 -3
- data/src/core/{lib/channel → telemetry}/call_tracer.cc +25 -35
- data/src/core/{lib/channel → telemetry}/call_tracer.h +33 -11
- data/src/core/{lib/debug → telemetry}/histogram_view.cc +2 -2
- data/src/core/{lib/debug → telemetry}/histogram_view.h +5 -5
- data/src/core/telemetry/metrics.cc +178 -0
- data/src/core/telemetry/metrics.h +562 -0
- data/src/core/{lib/debug → telemetry}/stats.cc +3 -3
- data/src/core/{lib/debug → telemetry}/stats.h +7 -7
- data/src/core/{lib/debug → telemetry}/stats_data.cc +3 -3
- data/src/core/{lib/debug → telemetry}/stats_data.h +6 -6
- data/src/core/{lib/channel → telemetry}/tcp_tracer.h +5 -5
- data/src/core/tsi/alts/crypt/aes_gcm.cc +1 -2
- data/src/core/tsi/alts/crypt/gsec.cc +1 -2
- data/src/core/tsi/alts/crypt/gsec.h +1 -2
- data/src/core/tsi/alts/frame_protector/alts_counter.cc +1 -2
- data/src/core/tsi/alts/frame_protector/alts_counter.h +1 -2
- data/src/core/tsi/alts/frame_protector/alts_crypter.cc +1 -2
- data/src/core/tsi/alts/frame_protector/alts_crypter.h +1 -2
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -15
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +2 -2
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc +1 -2
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +1 -2
- data/src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc +1 -2
- data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +1 -2
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +1 -2
- data/src/core/tsi/alts/frame_protector/frame_handler.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +63 -64
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -2
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +5 -4
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +1 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +54 -53
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +7 -5
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +1 -2
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +10 -8
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +6 -5
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +1 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +10 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +1 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +9 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +2 -2
- data/src/core/tsi/fake_transport_security.cc +20 -21
- data/src/core/tsi/local_transport_security.cc +7 -7
- data/src/core/tsi/local_transport_security.h +1 -2
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +6 -5
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +1 -2
- data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +15 -14
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +1 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -4
- data/src/core/tsi/ssl_transport_security.cc +96 -100
- data/src/core/tsi/ssl_transport_security.h +1 -2
- data/src/core/tsi/ssl_transport_security_utils.cc +85 -28
- data/src/core/tsi/ssl_transport_security_utils.h +12 -2
- data/src/core/tsi/ssl_types.h +2 -2
- data/src/core/tsi/transport_security.cc +1 -6
- data/src/core/tsi/transport_security.h +2 -4
- data/src/core/tsi/transport_security_grpc.cc +2 -2
- data/src/core/tsi/transport_security_grpc.h +1 -2
- data/src/core/tsi/transport_security_interface.h +2 -6
- data/src/core/{lib/gpr → util}/alloc.cc +3 -1
- data/src/core/{lib/gpr → util}/alloc.h +3 -3
- data/src/core/{lib/gpr → util}/android/log.cc +0 -19
- data/src/core/{lib/gpr → util}/atm.cc +1 -1
- data/src/core/{ext/gcp/metadata_query.cc → util/gcp_metadata_query.cc} +26 -26
- data/src/core/{ext/gcp/metadata_query.h → util/gcp_metadata_query.h} +9 -9
- data/src/core/{lib/http → util/http_client}/format_request.cc +2 -2
- data/src/core/{lib/http → util/http_client}/format_request.h +4 -4
- data/src/core/{lib/http → util/http_client}/httpcli.cc +12 -13
- data/src/core/{lib/http → util/http_client}/httpcli.h +5 -5
- data/src/core/{lib/http → util/http_client}/httpcli_security_connector.cc +10 -10
- data/src/core/{lib/http → util/http_client}/httpcli_ssl_credentials.h +3 -3
- data/src/core/{lib/http → util/http_client}/parser.cc +6 -7
- data/src/core/{lib/http → util/http_client}/parser.h +3 -5
- data/src/core/{lib → util}/json/json.h +3 -3
- data/src/core/{lib → util}/json/json_args.h +3 -3
- data/src/core/{lib → util}/json/json_channel_args.h +4 -4
- data/src/core/{lib → util}/json/json_object_loader.cc +1 -1
- data/src/core/{lib → util}/json/json_object_loader.h +5 -5
- data/src/core/{lib → util}/json/json_reader.cc +4 -3
- data/src/core/{lib → util}/json/json_reader.h +4 -4
- data/src/core/{lib → util}/json/json_util.cc +3 -3
- data/src/core/{lib → util}/json/json_util.h +4 -4
- data/src/core/{lib → util}/json/json_writer.cc +1 -1
- data/src/core/{lib → util}/json/json_writer.h +4 -4
- data/src/core/{lib/gpr → util}/linux/log.cc +0 -45
- data/src/core/util/log.cc +167 -0
- data/src/core/{lib/gpr → util}/msys/tmpfile.cc +2 -2
- data/src/core/{lib/gpr → util}/posix/cpu.cc +1 -1
- data/src/core/{lib/gpr → util}/posix/log.cc +0 -42
- data/src/core/{lib/gpr → util}/posix/sync.cc +25 -23
- data/src/core/{lib/gpr → util}/posix/time.cc +10 -7
- data/src/core/{lib/gpr → util}/posix/tmpfile.cc +5 -3
- data/src/core/{lib/gpr → util}/spinlock.h +3 -3
- data/src/core/{lib/gpr → util}/string.cc +2 -2
- data/src/core/{lib/gpr → util}/string.h +3 -3
- data/src/core/{lib/gpr → util}/sync.cc +5 -3
- data/src/core/{lib/gpr → util}/time.cc +10 -8
- data/src/core/{lib/gpr → util}/time_precise.cc +1 -1
- data/src/core/{lib/gpr → util}/time_precise.h +3 -3
- data/src/core/{lib/gpr → util}/tmpfile.h +3 -3
- data/src/core/{lib/gpr → util}/useful.h +3 -3
- data/src/core/{lib/gpr → util}/windows/log.cc +1 -44
- data/src/core/{lib/gpr → util}/windows/string.cc +1 -1
- data/src/core/{lib/gpr → util}/windows/string_util.cc +1 -1
- data/src/core/{lib/gpr → util}/windows/sync.cc +3 -1
- data/src/core/{lib/gpr → util}/windows/time.cc +5 -2
- data/src/core/{lib/gpr → util}/windows/tmpfile.cc +1 -1
- data/src/core/{ext/xds → xds/grpc}/certificate_provider_store.cc +5 -6
- data/src/core/{ext/xds → xds/grpc}/certificate_provider_store.h +8 -9
- data/src/core/{ext/xds → xds/grpc}/file_watcher_certificate_provider_factory.cc +5 -6
- data/src/core/{ext/xds → xds/grpc}/file_watcher_certificate_provider_factory.h +7 -8
- data/src/core/{ext/xds → xds/grpc}/upb_utils.h +5 -5
- data/src/core/{ext/xds → xds/grpc}/xds_audit_logger_registry.cc +4 -4
- data/src/core/{ext/xds → xds/grpc}/xds_audit_logger_registry.h +7 -7
- data/src/core/{ext/xds → xds/grpc}/xds_bootstrap_grpc.cc +7 -8
- data/src/core/{ext/xds → xds/grpc}/xds_bootstrap_grpc.h +14 -14
- data/src/core/{ext/xds → xds/grpc}/xds_certificate_provider.cc +5 -5
- data/src/core/{ext/xds → xds/grpc}/xds_certificate_provider.h +5 -6
- data/src/core/{ext/xds → xds/grpc}/xds_client_grpc.cc +51 -34
- data/src/core/{ext/xds → xds/grpc}/xds_client_grpc.h +10 -11
- data/src/core/{ext/xds → xds/grpc}/xds_cluster.cc +22 -14
- data/src/core/{ext/xds → xds/grpc}/xds_cluster.h +12 -13
- data/src/core/{ext/xds → xds/grpc}/xds_cluster_specifier_plugin.cc +6 -6
- data/src/core/{ext/xds → xds/grpc}/xds_cluster_specifier_plugin.h +7 -7
- data/src/core/{ext/xds → xds/grpc}/xds_common_types.cc +6 -7
- data/src/core/{ext/xds → xds/grpc}/xds_common_types.h +7 -7
- data/src/core/{ext/xds → xds/grpc}/xds_endpoint.cc +11 -12
- data/src/core/{ext/xds → xds/grpc}/xds_endpoint.h +9 -9
- data/src/core/{ext/xds → xds/grpc}/xds_health_status.cc +3 -3
- data/src/core/{ext/xds → xds/grpc}/xds_health_status.h +5 -5
- data/src/core/{ext/xds → xds/grpc}/xds_http_fault_filter.cc +6 -7
- data/src/core/{ext/xds → xds/grpc}/xds_http_fault_filter.h +8 -8
- data/src/core/{ext/xds → xds/grpc}/xds_http_filters.cc +8 -9
- data/src/core/{ext/xds → xds/grpc}/xds_http_filters.h +9 -9
- data/src/core/{ext/xds → xds/grpc}/xds_http_rbac_filter.cc +9 -10
- data/src/core/{ext/xds → xds/grpc}/xds_http_rbac_filter.h +8 -8
- data/src/core/{ext/xds → xds/grpc}/xds_http_stateful_session_filter.cc +7 -8
- data/src/core/{ext/xds → xds/grpc}/xds_http_stateful_session_filter.h +8 -8
- data/src/core/{ext/xds → xds/grpc}/xds_lb_policy_registry.cc +3 -4
- data/src/core/{ext/xds → xds/grpc}/xds_lb_policy_registry.h +7 -7
- data/src/core/{ext/xds → xds/grpc}/xds_listener.cc +12 -14
- data/src/core/{ext/xds → xds/grpc}/xds_listener.h +12 -12
- data/src/core/{ext/xds → xds/grpc}/xds_route_config.cc +23 -24
- data/src/core/{ext/xds → xds/grpc}/xds_route_config.h +11 -11
- data/src/core/{ext/xds → xds/grpc}/xds_routing.cc +6 -6
- data/src/core/{ext/xds → xds/grpc}/xds_routing.h +8 -8
- data/src/core/{ext/xds → xds/grpc}/xds_transport_grpc.cc +16 -16
- data/src/core/{ext/xds → xds/grpc}/xds_transport_grpc.h +7 -8
- data/src/core/{ext/xds → xds/xds_client}/xds_api.cc +9 -14
- data/src/core/{ext/xds → xds/xds_client}/xds_api.h +7 -7
- data/src/core/{ext/xds → xds/xds_client}/xds_bootstrap.cc +4 -4
- data/src/core/{ext/xds → xds/xds_client}/xds_bootstrap.h +6 -6
- data/src/core/{ext/xds → xds/xds_client}/xds_channel_args.h +3 -3
- data/src/core/{ext/xds → xds/xds_client}/xds_client.cc +60 -62
- data/src/core/{ext/xds → xds/xds_client}/xds_client.h +10 -14
- data/src/core/{ext/xds → xds/xds_client}/xds_client_stats.cc +23 -22
- data/src/core/{ext/xds → xds/xds_client}/xds_client_stats.h +8 -8
- data/src/core/{ext/xds → xds/xds_client}/xds_metrics.h +7 -5
- data/src/core/{ext/xds → xds/xds_client}/xds_resource_type.h +6 -6
- data/src/core/{ext/xds → xds/xds_client}/xds_resource_type_impl.h +7 -7
- data/src/core/{ext/xds → xds/xds_client}/xds_transport.h +6 -6
- data/src/ruby/bin/math_pb.rb +1 -22
- data/src/ruby/ext/grpc/rb_call.c +8 -1
- data/src/ruby/ext/grpc/rb_call_credentials.c +1 -0
- data/src/ruby/ext/grpc/rb_call_credentials.h +1 -0
- data/src/ruby/ext/grpc/rb_channel.c +1 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +1 -0
- data/src/ruby/ext/grpc/rb_completion_queue.c +15 -32
- data/src/ruby/ext/grpc/rb_completion_queue.h +7 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +130 -130
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +198 -197
- data/src/ruby/ext/grpc/rb_server.c +40 -22
- data/src/ruby/ext/grpc/rb_server_credentials.c +1 -0
- data/src/ruby/ext/grpc/rb_server_credentials.h +1 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +1 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +1 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +1 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +1 -22
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +5 -5
- data/src/ruby/pb/grpc/testing/metrics_pb.rb +10 -19
- data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +5 -5
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +1 -22
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +1 -22
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +1 -22
- data/third_party/abseil-cpp/absl/log/check.h +209 -0
- data/third_party/abseil-cpp/absl/log/internal/check_impl.h +150 -0
- data/third_party/abseil-cpp/absl/log/internal/check_op.cc +118 -0
- data/third_party/abseil-cpp/absl/log/internal/check_op.h +420 -0
- data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +13 -18
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +25 -10
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +3 -18
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/unicode.c +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +19 -15
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_des.c +48 -66
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_null.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_rc2.c +20 -28
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_rc4.c +9 -4
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +66 -41
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_intel.c +0 -15
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +7 -61
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/dilithium/dilithium.c +1539 -0
- data/third_party/boringssl-with-bazel/src/crypto/dilithium/internal.h +58 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +36 -20
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +81 -60
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +41 -120
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +13 -13
- data/third_party/boringssl-with-bazel/src/crypto/evp/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_dh.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_dh_asn1.c +120 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +30 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +30 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ed25519.c +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa_asn1.c +30 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_x25519.c +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +6 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c +21 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +31 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +5 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bytes.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div_extra.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +46 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +8 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +33 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +14 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/random.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h +0 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +11 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +5 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.c +3 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +11 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +22 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/fips.c +6 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/service_indicator.c +3 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +78 -29
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +10 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +62 -27
- data/third_party/boringssl-with-bazel/src/crypto/kyber/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +18 -9
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +18 -17
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +44 -41
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +13 -12
- data/third_party/boringssl-with-bazel/src/crypto/spx/spx.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +26 -33
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +4 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +5 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/v3_cpols.c +9 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/v3_crld.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/v3_info.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/v3_lib.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/v3_utl.c +49 -16
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +0 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +21 -25
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +8 -25
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +1 -6
- data/third_party/boringssl-with-bazel/{err_data.c → src/gen/crypto/err_data.c} +487 -485
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +9 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +85 -42
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +12 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +10 -11
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +17 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +10 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +13 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +25 -14
- data/third_party/boringssl-with-bazel/src/include/openssl/evp_errors.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ex_data.h +15 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +131 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/{kyber.h → experimental/kyber.h} +10 -0
- data/third_party/boringssl-with-bazel/src/{crypto/spx/internal.h → include/openssl/experimental/spx.h} +24 -13
- data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +63 -53
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +19 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +26 -12
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +358 -102
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +10 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +13 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +2931 -2453
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +6 -8
- data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +4 -4
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +19 -18
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +3 -9
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +64 -58
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +17 -7
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +69 -16
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +145 -114
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +243 -189
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +59 -385
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +21 -19
- data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +423 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +2 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +108 -81
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +116 -93
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +6 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +48 -116
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +21 -27
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +36 -3
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +53 -18
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +1 -1
- metadata +207 -196
- data/src/core/client_channel/client_channel_channelz.cc +0 -93
- data/src/core/client_channel/client_channel_channelz.h +0 -85
- data/src/core/ext/filters/deadline/deadline_filter.cc +0 -407
- data/src/core/ext/filters/deadline/deadline_filter.h +0 -85
- data/src/core/ext/transport/chttp2/transport/http_trace.cc +0 -19
- data/src/core/ext/transport/chttp2/transport/http_trace.h +0 -24
- data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -23
- data/src/core/lib/channel/channel_stack_trace.cc +0 -19
- data/src/core/lib/channel/channel_stack_trace.h +0 -24
- data/src/core/lib/channel/context.h +0 -77
- data/src/core/lib/channel/metrics.cc +0 -396
- data/src/core/lib/channel/metrics.h +0 -406
- data/src/core/lib/event_engine/trace.cc +0 -25
- data/src/core/lib/gpr/log.cc +0 -166
- data/src/core/lib/gpr/log_internal.h +0 -55
- data/src/core/lib/iomgr/ev_windows.cc +0 -30
- data/src/core/lib/promise/trace.cc +0 -20
- data/src/core/lib/promise/trace.h +0 -24
- data/src/core/lib/resource_quota/trace.cc +0 -19
- data/src/core/lib/resource_quota/trace.h +0 -24
- data/src/core/lib/security/transport/tsi_error.cc +0 -31
- data/src/core/lib/security/transport/tsi_error.h +0 -30
- data/src/core/lib/slice/slice_refcount.cc +0 -20
- data/src/core/lib/surface/api_trace.cc +0 -25
- data/src/core/lib/surface/call_trace.h +0 -24
- data/src/core/lib/surface/wait_for_cq_end_op.cc +0 -75
- data/src/core/lib/surface/wait_for_cq_end_op.h +0 -72
- data/src/core/lib/transport/batch_builder.cc +0 -170
- data/src/core/lib/transport/batch_builder.h +0 -476
- data/src/core/resolver/xds/xds_resolver_trace.cc +0 -25
- data/src/core/resolver/xds/xds_resolver_trace.h +0 -30
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +0 -122
- data/third_party/boringssl-with-bazel/src/include/openssl/pki/certificate.h +0 -83
- data/third_party/boringssl-with-bazel/src/include/openssl/pki/signature_verify_cache.h +0 -41
- /data/src/core/{lib/gpr → util}/iphone/cpu.cc +0 -0
- /data/src/core/{lib/gpr → util}/linux/cpu.cc +0 -0
- /data/src/core/{lib/gpr → util}/posix/string.cc +0 -0
- /data/src/core/{lib/gpr → util}/sync_abseil.cc +0 -0
- /data/src/core/{lib/gpr → util}/windows/cpu.cc +0 -0
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
//
|
|
16
16
|
|
|
17
|
-
#include <grpc/support/port_platform.h>
|
|
18
|
-
|
|
19
17
|
#include "src/core/load_balancing/pick_first/pick_first.h"
|
|
20
18
|
|
|
21
19
|
#include <inttypes.h>
|
|
@@ -29,6 +27,7 @@
|
|
|
29
27
|
#include <vector>
|
|
30
28
|
|
|
31
29
|
#include "absl/algorithm/container.h"
|
|
30
|
+
#include "absl/log/check.h"
|
|
32
31
|
#include "absl/random/random.h"
|
|
33
32
|
#include "absl/status/status.h"
|
|
34
33
|
#include "absl/status/statusor.h"
|
|
@@ -40,14 +39,13 @@
|
|
|
40
39
|
#include <grpc/impl/channel_arg_names.h>
|
|
41
40
|
#include <grpc/impl/connectivity_state.h>
|
|
42
41
|
#include <grpc/support/log.h>
|
|
42
|
+
#include <grpc/support/port_platform.h>
|
|
43
43
|
|
|
44
|
-
#include "src/core/load_balancing/health_check_client.h"
|
|
45
44
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
|
46
45
|
#include "src/core/lib/channel/channel_args.h"
|
|
47
|
-
#include "src/core/lib/channel/metrics.h"
|
|
48
46
|
#include "src/core/lib/config/core_configuration.h"
|
|
49
47
|
#include "src/core/lib/debug/trace.h"
|
|
50
|
-
#include "src/core/lib/
|
|
48
|
+
#include "src/core/lib/experiments/experiments.h"
|
|
51
49
|
#include "src/core/lib/gprpp/crash.h"
|
|
52
50
|
#include "src/core/lib/gprpp/debug_location.h"
|
|
53
51
|
#include "src/core/lib/gprpp/orphanable.h"
|
|
@@ -57,67 +55,1081 @@
|
|
|
57
55
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
|
58
56
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
|
59
57
|
#include "src/core/lib/iomgr/resolved_address.h"
|
|
60
|
-
#include "src/core/lib/json/json.h"
|
|
61
|
-
#include "src/core/lib/json/json_args.h"
|
|
62
|
-
#include "src/core/lib/json/json_object_loader.h"
|
|
63
58
|
#include "src/core/lib/transport/connectivity_state.h"
|
|
59
|
+
#include "src/core/load_balancing/health_check_client.h"
|
|
64
60
|
#include "src/core/load_balancing/lb_policy.h"
|
|
65
61
|
#include "src/core/load_balancing/lb_policy_factory.h"
|
|
66
62
|
#include "src/core/load_balancing/subchannel_interface.h"
|
|
67
63
|
#include "src/core/resolver/endpoint_addresses.h"
|
|
64
|
+
#include "src/core/telemetry/metrics.h"
|
|
65
|
+
#include "src/core/util/json/json.h"
|
|
66
|
+
#include "src/core/util/json/json_args.h"
|
|
67
|
+
#include "src/core/util/json/json_object_loader.h"
|
|
68
|
+
#include "src/core/util/useful.h"
|
|
68
69
|
|
|
69
70
|
namespace grpc_core {
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
namespace {
|
|
73
|
+
|
|
74
|
+
//
|
|
75
|
+
// pick_first LB policy
|
|
76
|
+
//
|
|
77
|
+
|
|
78
|
+
constexpr absl::string_view kPickFirst = "pick_first";
|
|
79
|
+
|
|
80
|
+
const auto kMetricDisconnections =
|
|
81
|
+
GlobalInstrumentsRegistry::RegisterUInt64Counter(
|
|
82
|
+
"grpc.lb.pick_first.disconnections",
|
|
83
|
+
"EXPERIMENTAL. Number of times the selected subchannel becomes "
|
|
84
|
+
"disconnected.",
|
|
85
|
+
"{disconnection}", false)
|
|
86
|
+
.Labels(kMetricLabelTarget)
|
|
87
|
+
.Build();
|
|
88
|
+
|
|
89
|
+
const auto kMetricConnectionAttemptsSucceeded =
|
|
90
|
+
GlobalInstrumentsRegistry::RegisterUInt64Counter(
|
|
91
|
+
"grpc.lb.pick_first.connection_attempts_succeeded",
|
|
92
|
+
"EXPERIMENTAL. Number of successful connection attempts.", "{attempt}",
|
|
93
|
+
false)
|
|
94
|
+
.Labels(kMetricLabelTarget)
|
|
95
|
+
.Build();
|
|
96
|
+
|
|
97
|
+
const auto kMetricConnectionAttemptsFailed =
|
|
98
|
+
GlobalInstrumentsRegistry::RegisterUInt64Counter(
|
|
99
|
+
"grpc.lb.pick_first.connection_attempts_failed",
|
|
100
|
+
"EXPERIMENTAL. Number of failed connection attempts.", "{attempt}",
|
|
101
|
+
false)
|
|
102
|
+
.Labels(kMetricLabelTarget)
|
|
103
|
+
.Build();
|
|
104
|
+
|
|
105
|
+
class PickFirstConfig final : public LoadBalancingPolicy::Config {
|
|
106
|
+
public:
|
|
107
|
+
absl::string_view name() const override { return kPickFirst; }
|
|
108
|
+
bool shuffle_addresses() const { return shuffle_addresses_; }
|
|
109
|
+
|
|
110
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&) {
|
|
111
|
+
static const auto kJsonLoader =
|
|
112
|
+
JsonObjectLoader<PickFirstConfig>()
|
|
113
|
+
.OptionalField("shuffleAddressList",
|
|
114
|
+
&PickFirstConfig::shuffle_addresses_)
|
|
115
|
+
.Finish();
|
|
116
|
+
return kJsonLoader;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private:
|
|
120
|
+
bool shuffle_addresses_ = false;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
class PickFirst final : public LoadBalancingPolicy {
|
|
124
|
+
public:
|
|
125
|
+
explicit PickFirst(Args args);
|
|
126
|
+
|
|
127
|
+
absl::string_view name() const override { return kPickFirst; }
|
|
128
|
+
|
|
129
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
|
130
|
+
void ExitIdleLocked() override;
|
|
131
|
+
void ResetBackoffLocked() override;
|
|
132
|
+
|
|
133
|
+
private:
|
|
134
|
+
~PickFirst() override;
|
|
135
|
+
|
|
136
|
+
// A list of subchannels that we will attempt connections on.
|
|
137
|
+
class SubchannelList final : public InternallyRefCounted<SubchannelList> {
|
|
138
|
+
public:
|
|
139
|
+
// Data about the subchannel that is needed only while attempting to
|
|
140
|
+
// connect.
|
|
141
|
+
class SubchannelData final {
|
|
142
|
+
public:
|
|
143
|
+
// Stores the subchannel and its watcher. This is the state that
|
|
144
|
+
// is retained once a subchannel is chosen.
|
|
145
|
+
class SubchannelState final
|
|
146
|
+
: public InternallyRefCounted<SubchannelState> {
|
|
147
|
+
public:
|
|
148
|
+
SubchannelState(SubchannelData* subchannel_data,
|
|
149
|
+
RefCountedPtr<SubchannelInterface> subchannel);
|
|
150
|
+
|
|
151
|
+
void Orphan() override;
|
|
152
|
+
|
|
153
|
+
SubchannelInterface* subchannel() const { return subchannel_.get(); }
|
|
154
|
+
|
|
155
|
+
void RequestConnection() { subchannel_->RequestConnection(); }
|
|
156
|
+
|
|
157
|
+
void ResetBackoffLocked() { subchannel_->ResetBackoff(); }
|
|
158
|
+
|
|
159
|
+
private:
|
|
160
|
+
// Watcher for subchannel connectivity state.
|
|
161
|
+
class Watcher
|
|
162
|
+
: public SubchannelInterface::ConnectivityStateWatcherInterface {
|
|
163
|
+
public:
|
|
164
|
+
explicit Watcher(RefCountedPtr<SubchannelState> subchannel_state)
|
|
165
|
+
: subchannel_state_(std::move(subchannel_state)) {}
|
|
166
|
+
|
|
167
|
+
~Watcher() override {
|
|
168
|
+
subchannel_state_.reset(DEBUG_LOCATION, "Watcher dtor");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
void OnConnectivityStateChange(grpc_connectivity_state new_state,
|
|
172
|
+
absl::Status status) override {
|
|
173
|
+
subchannel_state_->OnConnectivityStateChange(new_state,
|
|
174
|
+
std::move(status));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
grpc_pollset_set* interested_parties() override {
|
|
178
|
+
return subchannel_state_->pick_first_->interested_parties();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private:
|
|
182
|
+
RefCountedPtr<SubchannelState> subchannel_state_;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Selects this subchannel. Called when the subchannel reports READY.
|
|
186
|
+
void Select();
|
|
187
|
+
|
|
188
|
+
// This method will be invoked once soon after instantiation to report
|
|
189
|
+
// the current connectivity state, and it will then be invoked again
|
|
190
|
+
// whenever the connectivity state changes.
|
|
191
|
+
void OnConnectivityStateChange(grpc_connectivity_state new_state,
|
|
192
|
+
absl::Status status);
|
|
193
|
+
|
|
194
|
+
// If non-null, then we are still part of a subchannel list
|
|
195
|
+
// trying to connect.
|
|
196
|
+
SubchannelData* subchannel_data_;
|
|
197
|
+
|
|
198
|
+
// TODO(roth): Once we remove pollset_set, we should no longer
|
|
199
|
+
// need to hold a ref to PickFirst. Instead, we can make this a
|
|
200
|
+
// raw pointer and put it in an absl::variant with subchannel_data_.
|
|
201
|
+
RefCountedPtr<PickFirst> pick_first_;
|
|
202
|
+
|
|
203
|
+
RefCountedPtr<SubchannelInterface> subchannel_;
|
|
204
|
+
SubchannelInterface::ConnectivityStateWatcherInterface* watcher_ =
|
|
205
|
+
nullptr;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
SubchannelData(SubchannelList* subchannel_list, size_t index,
|
|
209
|
+
RefCountedPtr<SubchannelInterface> subchannel);
|
|
210
|
+
|
|
211
|
+
absl::optional<grpc_connectivity_state> connectivity_state() const {
|
|
212
|
+
return connectivity_state_;
|
|
213
|
+
}
|
|
214
|
+
const absl::Status& connectivity_status() const {
|
|
215
|
+
return connectivity_status_;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
void RequestConnection() { subchannel_state_->RequestConnection(); }
|
|
219
|
+
|
|
220
|
+
// Resets the connection backoff.
|
|
221
|
+
void ResetBackoffLocked() { subchannel_state_->ResetBackoffLocked(); }
|
|
222
|
+
|
|
223
|
+
// Requests a connection attempt to start on this subchannel,
|
|
224
|
+
// with appropriate Connection Attempt Delay.
|
|
225
|
+
// Used only during the Happy Eyeballs pass.
|
|
226
|
+
void RequestConnectionWithTimer();
|
|
227
|
+
|
|
228
|
+
bool seen_transient_failure() const { return seen_transient_failure_; }
|
|
229
|
+
|
|
230
|
+
private:
|
|
231
|
+
// This method will be invoked once soon after instantiation to report
|
|
232
|
+
// the current connectivity state, and it will then be invoked again
|
|
233
|
+
// whenever the connectivity state changes.
|
|
234
|
+
void OnConnectivityStateChange(grpc_connectivity_state new_state,
|
|
235
|
+
absl::Status status);
|
|
236
|
+
|
|
237
|
+
// Backpointer to owning subchannel list. Not owned.
|
|
238
|
+
SubchannelList* subchannel_list_;
|
|
239
|
+
// Our index within subchannel_list_.
|
|
240
|
+
const size_t index_;
|
|
241
|
+
// Subchannel state.
|
|
242
|
+
OrphanablePtr<SubchannelState> subchannel_state_;
|
|
243
|
+
// Data updated by the watcher.
|
|
244
|
+
absl::optional<grpc_connectivity_state> connectivity_state_;
|
|
245
|
+
absl::Status connectivity_status_;
|
|
246
|
+
bool seen_transient_failure_ = false;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
SubchannelList(RefCountedPtr<PickFirst> policy,
|
|
250
|
+
EndpointAddressesIterator* addresses,
|
|
251
|
+
const ChannelArgs& args);
|
|
252
|
+
|
|
253
|
+
~SubchannelList() override;
|
|
254
|
+
|
|
255
|
+
void Orphan() override;
|
|
256
|
+
|
|
257
|
+
// The number of subchannels in the list.
|
|
258
|
+
size_t size() const { return subchannels_.size(); }
|
|
259
|
+
|
|
260
|
+
// Resets connection backoff of all subchannels.
|
|
261
|
+
void ResetBackoffLocked();
|
|
262
|
+
|
|
263
|
+
bool IsHappyEyeballsPassComplete() const {
|
|
264
|
+
// Checking attempting_index_ here is just an optimization -- if
|
|
265
|
+
// we haven't actually tried all subchannels yet, then we don't
|
|
266
|
+
// need to iterate.
|
|
267
|
+
if (attempting_index_ < size()) return false;
|
|
268
|
+
for (const auto& sd : subchannels_) {
|
|
269
|
+
if (!sd->seen_transient_failure()) return false;
|
|
270
|
+
}
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private:
|
|
275
|
+
// Returns true if all subchannels have seen their initial
|
|
276
|
+
// connectivity state notifications.
|
|
277
|
+
bool AllSubchannelsSeenInitialState() const {
|
|
278
|
+
return num_subchannels_seen_initial_notification_ == size();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Looks through subchannels_ starting from attempting_index_ to
|
|
282
|
+
// find the first one not currently in TRANSIENT_FAILURE, then
|
|
283
|
+
// triggers a connection attempt for that subchannel. If there are
|
|
284
|
+
// no more subchannels not in TRANSIENT_FAILURE, calls
|
|
285
|
+
// MaybeFinishHappyEyeballsPass().
|
|
286
|
+
void StartConnectingNextSubchannel();
|
|
287
|
+
|
|
288
|
+
// Checks to see if the initial Happy Eyeballs pass is complete --
|
|
289
|
+
// i.e., all subchannels have seen TRANSIENT_FAILURE state at least once.
|
|
290
|
+
// If so, transitions to a mode where we try to connect to all subchannels
|
|
291
|
+
// in parallel and returns true.
|
|
292
|
+
void MaybeFinishHappyEyeballsPass();
|
|
293
|
+
|
|
294
|
+
// Backpointer to owning policy.
|
|
295
|
+
RefCountedPtr<PickFirst> policy_;
|
|
296
|
+
|
|
297
|
+
ChannelArgs args_;
|
|
298
|
+
|
|
299
|
+
// The list of subchannels.
|
|
300
|
+
std::vector<std::unique_ptr<SubchannelData>> subchannels_;
|
|
301
|
+
|
|
302
|
+
// Is this list shutting down? This may be true due to the shutdown of the
|
|
303
|
+
// policy itself or because a newer update has arrived while this one hadn't
|
|
304
|
+
// finished processing.
|
|
305
|
+
bool shutting_down_ = false;
|
|
306
|
+
|
|
307
|
+
size_t num_subchannels_seen_initial_notification_ = 0;
|
|
308
|
+
|
|
309
|
+
// The index into subchannels_ to which we are currently attempting
|
|
310
|
+
// to connect during the initial Happy Eyeballs pass. Once the
|
|
311
|
+
// initial pass is over, this will be equal to size().
|
|
312
|
+
size_t attempting_index_ = 0;
|
|
313
|
+
// Happy Eyeballs timer handle.
|
|
314
|
+
absl::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>
|
|
315
|
+
timer_handle_;
|
|
316
|
+
|
|
317
|
+
// After the initial Happy Eyeballs pass, the number of failures
|
|
318
|
+
// we've seen. Every size() failures, we trigger re-resolution.
|
|
319
|
+
size_t num_failures_ = 0;
|
|
320
|
+
|
|
321
|
+
// The status from the last subchannel that reported TRANSIENT_FAILURE.
|
|
322
|
+
absl::Status last_failure_;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
class HealthWatcher final
|
|
326
|
+
: public SubchannelInterface::ConnectivityStateWatcherInterface {
|
|
327
|
+
public:
|
|
328
|
+
explicit HealthWatcher(RefCountedPtr<PickFirst> policy)
|
|
329
|
+
: policy_(std::move(policy)) {}
|
|
330
|
+
|
|
331
|
+
~HealthWatcher() override {
|
|
332
|
+
policy_.reset(DEBUG_LOCATION, "HealthWatcher dtor");
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
void OnConnectivityStateChange(grpc_connectivity_state new_state,
|
|
336
|
+
absl::Status status) override;
|
|
337
|
+
|
|
338
|
+
grpc_pollset_set* interested_parties() override {
|
|
339
|
+
return policy_->interested_parties();
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
private:
|
|
343
|
+
RefCountedPtr<PickFirst> policy_;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
class Picker final : public SubchannelPicker {
|
|
347
|
+
public:
|
|
348
|
+
explicit Picker(RefCountedPtr<SubchannelInterface> subchannel)
|
|
349
|
+
: subchannel_(std::move(subchannel)) {}
|
|
350
|
+
|
|
351
|
+
PickResult Pick(PickArgs /*args*/) override {
|
|
352
|
+
return PickResult::Complete(subchannel_);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
private:
|
|
356
|
+
RefCountedPtr<SubchannelInterface> subchannel_;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
void ShutdownLocked() override;
|
|
360
|
+
|
|
361
|
+
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
|
|
362
|
+
RefCountedPtr<SubchannelPicker> picker);
|
|
363
|
+
|
|
364
|
+
void AttemptToConnectUsingLatestUpdateArgsLocked();
|
|
365
|
+
|
|
366
|
+
void UnsetSelectedSubchannel();
|
|
367
|
+
|
|
368
|
+
void GoIdle();
|
|
369
|
+
|
|
370
|
+
// When ExitIdleLocked() is called, we create a subchannel_list_ and start
|
|
371
|
+
// trying to connect, but we don't actually change state_ until the first
|
|
372
|
+
// subchannel reports CONNECTING. So in order to know if we're really
|
|
373
|
+
// idle, we need to check both state_ and subchannel_list_.
|
|
374
|
+
bool IsIdle() const {
|
|
375
|
+
return state_ == GRPC_CHANNEL_IDLE && subchannel_list_ == nullptr;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Whether we should enable health watching.
|
|
379
|
+
const bool enable_health_watch_;
|
|
380
|
+
// Whether we should omit our status message prefix.
|
|
381
|
+
const bool omit_status_message_prefix_;
|
|
382
|
+
// Connection Attempt Delay for Happy Eyeballs.
|
|
383
|
+
const Duration connection_attempt_delay_;
|
|
384
|
+
|
|
385
|
+
// Lateset update args.
|
|
386
|
+
UpdateArgs latest_update_args_;
|
|
387
|
+
// The list of subchannels that we're currently trying to connect to.
|
|
388
|
+
// Will generally be null when selected_ is set, except when we get a
|
|
389
|
+
// resolver update and need to check initial connectivity states for
|
|
390
|
+
// the new list to decide whether we keep using the existing
|
|
391
|
+
// connection or go IDLE.
|
|
392
|
+
OrphanablePtr<SubchannelList> subchannel_list_;
|
|
393
|
+
// Selected subchannel. Will generally be null when subchannel_list_
|
|
394
|
+
// is non-null, with the exception mentioned above.
|
|
395
|
+
OrphanablePtr<SubchannelList::SubchannelData::SubchannelState> selected_;
|
|
396
|
+
// Health watcher for the selected subchannel.
|
|
397
|
+
SubchannelInterface::ConnectivityStateWatcherInterface* health_watcher_ =
|
|
398
|
+
nullptr;
|
|
399
|
+
SubchannelInterface::DataWatcherInterface* health_data_watcher_ = nullptr;
|
|
400
|
+
// Current connectivity state.
|
|
401
|
+
grpc_connectivity_state state_ = GRPC_CHANNEL_CONNECTING;
|
|
402
|
+
// Are we shut down?
|
|
403
|
+
bool shutdown_ = false;
|
|
404
|
+
// Random bit generator used for shuffling addresses if configured
|
|
405
|
+
absl::BitGen bit_gen_;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
PickFirst::PickFirst(Args args)
|
|
409
|
+
: LoadBalancingPolicy(std::move(args)),
|
|
410
|
+
enable_health_watch_(
|
|
411
|
+
channel_args()
|
|
412
|
+
.GetBool(GRPC_ARG_INTERNAL_PICK_FIRST_ENABLE_HEALTH_CHECKING)
|
|
413
|
+
.value_or(false)),
|
|
414
|
+
omit_status_message_prefix_(
|
|
415
|
+
channel_args()
|
|
416
|
+
.GetBool(GRPC_ARG_INTERNAL_PICK_FIRST_OMIT_STATUS_MESSAGE_PREFIX)
|
|
417
|
+
.value_or(false)),
|
|
418
|
+
connection_attempt_delay_(Duration::Milliseconds(
|
|
419
|
+
Clamp(channel_args()
|
|
420
|
+
.GetInt(GRPC_ARG_HAPPY_EYEBALLS_CONNECTION_ATTEMPT_DELAY_MS)
|
|
421
|
+
.value_or(250),
|
|
422
|
+
100, 2000))) {
|
|
423
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
424
|
+
gpr_log(GPR_INFO, "Pick First %p created.", this);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
PickFirst::~PickFirst() {
|
|
429
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
430
|
+
gpr_log(GPR_INFO, "Destroying Pick First %p", this);
|
|
431
|
+
}
|
|
432
|
+
CHECK(subchannel_list_ == nullptr);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
void PickFirst::ShutdownLocked() {
|
|
436
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
437
|
+
gpr_log(GPR_INFO, "Pick First %p Shutting down", this);
|
|
438
|
+
}
|
|
439
|
+
shutdown_ = true;
|
|
440
|
+
UnsetSelectedSubchannel();
|
|
441
|
+
subchannel_list_.reset();
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
void PickFirst::ExitIdleLocked() {
|
|
445
|
+
if (shutdown_) return;
|
|
446
|
+
if (IsIdle()) {
|
|
447
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
448
|
+
gpr_log(GPR_INFO, "Pick First %p exiting idle", this);
|
|
449
|
+
}
|
|
450
|
+
AttemptToConnectUsingLatestUpdateArgsLocked();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
void PickFirst::ResetBackoffLocked() {
|
|
455
|
+
if (subchannel_list_ != nullptr) subchannel_list_->ResetBackoffLocked();
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
459
|
+
// Create a subchannel list from latest_update_args_.
|
|
460
|
+
EndpointAddressesIterator* addresses = nullptr;
|
|
461
|
+
if (latest_update_args_.addresses.ok()) {
|
|
462
|
+
addresses = latest_update_args_.addresses->get();
|
|
463
|
+
}
|
|
464
|
+
// Replace subchannel_list_.
|
|
465
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first) && subchannel_list_ != nullptr) {
|
|
466
|
+
gpr_log(GPR_INFO, "[PF %p] Shutting down previous subchannel list %p", this,
|
|
467
|
+
subchannel_list_.get());
|
|
468
|
+
}
|
|
469
|
+
subchannel_list_ = MakeOrphanable<SubchannelList>(
|
|
470
|
+
RefAsSubclass<PickFirst>(DEBUG_LOCATION, "SubchannelList"), addresses,
|
|
471
|
+
latest_update_args_.args);
|
|
472
|
+
// Empty update or no valid subchannels. Put the channel in
|
|
473
|
+
// TRANSIENT_FAILURE and request re-resolution. Also unset the
|
|
474
|
+
// current selected subchannel.
|
|
475
|
+
if (subchannel_list_->size() == 0) {
|
|
476
|
+
channel_control_helper()->RequestReresolution();
|
|
477
|
+
absl::Status status =
|
|
478
|
+
latest_update_args_.addresses.ok()
|
|
479
|
+
? absl::UnavailableError(absl::StrCat(
|
|
480
|
+
"empty address list: ", latest_update_args_.resolution_note))
|
|
481
|
+
: latest_update_args_.addresses.status();
|
|
482
|
+
UpdateState(GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
|
483
|
+
MakeRefCounted<TransientFailurePicker>(status));
|
|
484
|
+
UnsetSelectedSubchannel();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
absl::string_view GetAddressFamily(const grpc_resolved_address& address) {
|
|
489
|
+
const char* uri_scheme = grpc_sockaddr_get_uri_scheme(&address);
|
|
490
|
+
return absl::string_view(uri_scheme == nullptr ? "other" : uri_scheme);
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// An endpoint list iterator that returns only entries for a specific
|
|
494
|
+
// address family, as indicated by the URI scheme.
|
|
495
|
+
class AddressFamilyIterator final {
|
|
496
|
+
public:
|
|
497
|
+
AddressFamilyIterator(absl::string_view scheme, size_t index)
|
|
498
|
+
: scheme_(scheme), index_(index) {}
|
|
499
|
+
|
|
500
|
+
EndpointAddresses* Next(EndpointAddressesList& endpoints,
|
|
501
|
+
std::vector<bool>* endpoints_moved) {
|
|
502
|
+
for (; index_ < endpoints.size(); ++index_) {
|
|
503
|
+
if (!(*endpoints_moved)[index_] &&
|
|
504
|
+
GetAddressFamily(endpoints[index_].address()) == scheme_) {
|
|
505
|
+
(*endpoints_moved)[index_] = true;
|
|
506
|
+
return &endpoints[index_++];
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return nullptr;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
private:
|
|
513
|
+
absl::string_view scheme_;
|
|
514
|
+
size_t index_;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
absl::Status PickFirst::UpdateLocked(UpdateArgs args) {
|
|
518
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
519
|
+
if (args.addresses.ok()) {
|
|
520
|
+
gpr_log(GPR_INFO, "Pick First %p received update", this);
|
|
521
|
+
} else {
|
|
522
|
+
gpr_log(GPR_INFO, "Pick First %p received update with address error: %s",
|
|
523
|
+
this, args.addresses.status().ToString().c_str());
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
// Set return status based on the address list.
|
|
527
|
+
absl::Status status;
|
|
528
|
+
if (!args.addresses.ok()) {
|
|
529
|
+
status = args.addresses.status();
|
|
530
|
+
} else {
|
|
531
|
+
EndpointAddressesList endpoints;
|
|
532
|
+
(*args.addresses)->ForEach([&](const EndpointAddresses& endpoint) {
|
|
533
|
+
endpoints.push_back(endpoint);
|
|
534
|
+
});
|
|
535
|
+
if (endpoints.empty()) {
|
|
536
|
+
status = absl::UnavailableError("address list must not be empty");
|
|
537
|
+
} else {
|
|
538
|
+
// Shuffle the list if needed.
|
|
539
|
+
auto config = static_cast<PickFirstConfig*>(args.config.get());
|
|
540
|
+
if (config->shuffle_addresses()) {
|
|
541
|
+
absl::c_shuffle(endpoints, bit_gen_);
|
|
542
|
+
}
|
|
543
|
+
// Flatten the list so that we have one address per endpoint.
|
|
544
|
+
// While we're iterating, also determine the desired address family
|
|
545
|
+
// order and the index of the first element of each family, for use in
|
|
546
|
+
// the interleaving below.
|
|
547
|
+
std::set<absl::string_view> address_families;
|
|
548
|
+
std::vector<AddressFamilyIterator> address_family_order;
|
|
549
|
+
EndpointAddressesList flattened_endpoints;
|
|
550
|
+
for (const auto& endpoint : endpoints) {
|
|
551
|
+
for (const auto& address : endpoint.addresses()) {
|
|
552
|
+
flattened_endpoints.emplace_back(address, endpoint.args());
|
|
553
|
+
absl::string_view scheme = GetAddressFamily(address);
|
|
554
|
+
bool inserted = address_families.insert(scheme).second;
|
|
555
|
+
if (inserted) {
|
|
556
|
+
address_family_order.emplace_back(scheme,
|
|
557
|
+
flattened_endpoints.size() - 1);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
endpoints = std::move(flattened_endpoints);
|
|
562
|
+
// Interleave addresses as per RFC-8305 section 4.
|
|
563
|
+
EndpointAddressesList interleaved_endpoints;
|
|
564
|
+
interleaved_endpoints.reserve(endpoints.size());
|
|
565
|
+
std::vector<bool> endpoints_moved(endpoints.size());
|
|
566
|
+
size_t scheme_index = 0;
|
|
567
|
+
for (size_t i = 0; i < endpoints.size(); ++i) {
|
|
568
|
+
EndpointAddresses* endpoint;
|
|
569
|
+
do {
|
|
570
|
+
auto& iterator = address_family_order[scheme_index++ %
|
|
571
|
+
address_family_order.size()];
|
|
572
|
+
endpoint = iterator.Next(endpoints, &endpoints_moved);
|
|
573
|
+
} while (endpoint == nullptr);
|
|
574
|
+
interleaved_endpoints.emplace_back(std::move(*endpoint));
|
|
575
|
+
}
|
|
576
|
+
endpoints = std::move(interleaved_endpoints);
|
|
577
|
+
args.addresses =
|
|
578
|
+
std::make_shared<EndpointAddressesListIterator>(std::move(endpoints));
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
// If the update contains a resolver error and we have a previous update
|
|
582
|
+
// that was not a resolver error, keep using the previous addresses.
|
|
583
|
+
if (!args.addresses.ok() && latest_update_args_.config != nullptr) {
|
|
584
|
+
args.addresses = std::move(latest_update_args_.addresses);
|
|
585
|
+
}
|
|
586
|
+
// Update latest_update_args_.
|
|
587
|
+
latest_update_args_ = std::move(args);
|
|
588
|
+
// If we are not in idle, start connection attempt immediately.
|
|
589
|
+
// Otherwise, we defer the attempt into ExitIdleLocked().
|
|
590
|
+
if (!IsIdle()) {
|
|
591
|
+
AttemptToConnectUsingLatestUpdateArgsLocked();
|
|
592
|
+
}
|
|
593
|
+
return status;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
void PickFirst::UpdateState(grpc_connectivity_state state,
|
|
597
|
+
const absl::Status& status,
|
|
598
|
+
RefCountedPtr<SubchannelPicker> picker) {
|
|
599
|
+
state_ = state;
|
|
600
|
+
channel_control_helper()->UpdateState(state, status, std::move(picker));
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
void PickFirst::UnsetSelectedSubchannel() {
|
|
604
|
+
if (selected_ != nullptr && health_data_watcher_ != nullptr) {
|
|
605
|
+
selected_->subchannel()->CancelDataWatcher(health_data_watcher_);
|
|
606
|
+
}
|
|
607
|
+
selected_.reset();
|
|
608
|
+
health_watcher_ = nullptr;
|
|
609
|
+
health_data_watcher_ = nullptr;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
void PickFirst::GoIdle() {
|
|
613
|
+
// Unset the selected subchannel.
|
|
614
|
+
UnsetSelectedSubchannel();
|
|
615
|
+
// Drop the current subchannel list, if any.
|
|
616
|
+
subchannel_list_.reset();
|
|
617
|
+
// Request a re-resolution.
|
|
618
|
+
// TODO(qianchengz): We may want to request re-resolution in
|
|
619
|
+
// ExitIdleLocked() instead.
|
|
620
|
+
channel_control_helper()->RequestReresolution();
|
|
621
|
+
// Enter idle.
|
|
622
|
+
UpdateState(GRPC_CHANNEL_IDLE, absl::Status(),
|
|
623
|
+
MakeRefCounted<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker")));
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
//
|
|
627
|
+
// PickFirst::HealthWatcher
|
|
628
|
+
//
|
|
629
|
+
|
|
630
|
+
void PickFirst::HealthWatcher::OnConnectivityStateChange(
|
|
631
|
+
grpc_connectivity_state new_state, absl::Status status) {
|
|
632
|
+
if (policy_->health_watcher_ != this) return;
|
|
633
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
634
|
+
gpr_log(GPR_INFO, "[PF %p] health watch state update: %s (%s)",
|
|
635
|
+
policy_.get(), ConnectivityStateName(new_state),
|
|
636
|
+
status.ToString().c_str());
|
|
637
|
+
}
|
|
638
|
+
switch (new_state) {
|
|
639
|
+
case GRPC_CHANNEL_READY:
|
|
640
|
+
policy_->channel_control_helper()->UpdateState(
|
|
641
|
+
GRPC_CHANNEL_READY, absl::OkStatus(),
|
|
642
|
+
MakeRefCounted<Picker>(policy_->selected_->subchannel()->Ref()));
|
|
643
|
+
break;
|
|
644
|
+
case GRPC_CHANNEL_IDLE:
|
|
645
|
+
// If the subchannel becomes disconnected, the health watcher
|
|
646
|
+
// might happen to see the change before the raw connectivity
|
|
647
|
+
// state watcher does. In this case, ignore it, since the raw
|
|
648
|
+
// connectivity state watcher will handle it shortly.
|
|
649
|
+
break;
|
|
650
|
+
case GRPC_CHANNEL_CONNECTING:
|
|
651
|
+
policy_->channel_control_helper()->UpdateState(
|
|
652
|
+
new_state, absl::OkStatus(),
|
|
653
|
+
MakeRefCounted<QueuePicker>(policy_->Ref()));
|
|
654
|
+
break;
|
|
655
|
+
case GRPC_CHANNEL_TRANSIENT_FAILURE:
|
|
656
|
+
policy_->channel_control_helper()->UpdateState(
|
|
657
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
|
658
|
+
MakeRefCounted<TransientFailurePicker>(status));
|
|
659
|
+
break;
|
|
660
|
+
case GRPC_CHANNEL_SHUTDOWN:
|
|
661
|
+
Crash("health watcher reported state SHUTDOWN");
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
//
|
|
666
|
+
// PickFirst::SubchannelList::SubchannelData::SubchannelState
|
|
667
|
+
//
|
|
668
|
+
|
|
669
|
+
PickFirst::SubchannelList::SubchannelData::SubchannelState::SubchannelState(
|
|
670
|
+
SubchannelData* subchannel_data,
|
|
671
|
+
RefCountedPtr<SubchannelInterface> subchannel)
|
|
672
|
+
: subchannel_data_(subchannel_data),
|
|
673
|
+
pick_first_(subchannel_data_->subchannel_list_->policy_),
|
|
674
|
+
subchannel_(std::move(subchannel)) {
|
|
675
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
676
|
+
gpr_log(GPR_INFO,
|
|
677
|
+
"[PF %p] subchannel state %p (subchannel %p): starting watch",
|
|
678
|
+
pick_first_.get(), this, subchannel_.get());
|
|
679
|
+
}
|
|
680
|
+
auto watcher = std::make_unique<Watcher>(Ref(DEBUG_LOCATION, "Watcher"));
|
|
681
|
+
watcher_ = watcher.get();
|
|
682
|
+
subchannel_->WatchConnectivityState(std::move(watcher));
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
void PickFirst::SubchannelList::SubchannelData::SubchannelState::Orphan() {
|
|
686
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
687
|
+
gpr_log(GPR_INFO,
|
|
688
|
+
"[PF %p] subchannel state %p (subchannel %p): "
|
|
689
|
+
"cancelling watch and unreffing subchannel",
|
|
690
|
+
pick_first_.get(), this, subchannel_.get());
|
|
691
|
+
}
|
|
692
|
+
subchannel_data_ = nullptr;
|
|
693
|
+
subchannel_->CancelConnectivityStateWatch(watcher_);
|
|
694
|
+
watcher_ = nullptr;
|
|
695
|
+
subchannel_.reset();
|
|
696
|
+
pick_first_.reset();
|
|
697
|
+
Unref();
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
void PickFirst::SubchannelList::SubchannelData::SubchannelState::Select() {
|
|
701
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
702
|
+
gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", pick_first_.get(),
|
|
703
|
+
subchannel_.get());
|
|
704
|
+
}
|
|
705
|
+
CHECK_NE(subchannel_data_, nullptr);
|
|
706
|
+
pick_first_->UnsetSelectedSubchannel(); // Cancel health watch, if any.
|
|
707
|
+
pick_first_->selected_ = std::move(subchannel_data_->subchannel_state_);
|
|
708
|
+
// If health checking is enabled, start the health watch, but don't
|
|
709
|
+
// report a new picker -- we want to stay in CONNECTING while we wait
|
|
710
|
+
// for the health status notification.
|
|
711
|
+
// If health checking is NOT enabled, report READY.
|
|
712
|
+
if (pick_first_->enable_health_watch_) {
|
|
713
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
714
|
+
gpr_log(GPR_INFO, "[PF %p] starting health watch", pick_first_.get());
|
|
715
|
+
}
|
|
716
|
+
auto watcher = std::make_unique<HealthWatcher>(
|
|
717
|
+
pick_first_.Ref(DEBUG_LOCATION, "HealthWatcher"));
|
|
718
|
+
pick_first_->health_watcher_ = watcher.get();
|
|
719
|
+
auto health_data_watcher = MakeHealthCheckWatcher(
|
|
720
|
+
pick_first_->work_serializer(),
|
|
721
|
+
subchannel_data_->subchannel_list_->args_, std::move(watcher));
|
|
722
|
+
pick_first_->health_data_watcher_ = health_data_watcher.get();
|
|
723
|
+
subchannel_->AddDataWatcher(std::move(health_data_watcher));
|
|
724
|
+
} else {
|
|
725
|
+
pick_first_->UpdateState(GRPC_CHANNEL_READY, absl::Status(),
|
|
726
|
+
MakeRefCounted<Picker>(subchannel_));
|
|
727
|
+
}
|
|
728
|
+
// Report successful connection.
|
|
729
|
+
// We consider it a successful connection attempt only if the
|
|
730
|
+
// previous state was CONNECTING. In particular, we don't want to
|
|
731
|
+
// increment this counter if we got a new address list and found the
|
|
732
|
+
// existing connection already in state READY.
|
|
733
|
+
if (subchannel_data_->connectivity_state_ == GRPC_CHANNEL_CONNECTING) {
|
|
734
|
+
auto& stats_plugins =
|
|
735
|
+
pick_first_->channel_control_helper()->GetStatsPluginGroup();
|
|
736
|
+
stats_plugins.AddCounter(
|
|
737
|
+
kMetricConnectionAttemptsSucceeded, 1,
|
|
738
|
+
{pick_first_->channel_control_helper()->GetTarget()}, {});
|
|
739
|
+
}
|
|
740
|
+
// Drop our pointer to subchannel_data_, so that we know not to
|
|
741
|
+
// interact with it on subsequent connectivity state updates.
|
|
742
|
+
subchannel_data_ = nullptr;
|
|
743
|
+
// Clean up subchannel list.
|
|
744
|
+
pick_first_->subchannel_list_.reset();
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
void PickFirst::SubchannelList::SubchannelData::SubchannelState::
|
|
748
|
+
OnConnectivityStateChange(grpc_connectivity_state new_state,
|
|
749
|
+
absl::Status status) {
|
|
750
|
+
if (watcher_ == nullptr) return;
|
|
751
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
752
|
+
gpr_log(GPR_INFO,
|
|
753
|
+
"[PF %p] subchannel state %p (subchannel %p): connectivity "
|
|
754
|
+
"changed: new_state=%s, status=%s, watcher=%p, "
|
|
755
|
+
"subchannel_data_=%p, pick_first_->selected_=%p",
|
|
756
|
+
pick_first_.get(), this, subchannel_.get(),
|
|
757
|
+
ConnectivityStateName(new_state), status.ToString().c_str(),
|
|
758
|
+
watcher_, subchannel_data_, pick_first_->selected_.get());
|
|
759
|
+
}
|
|
760
|
+
// If we're still part of a subchannel list trying to connect, check
|
|
761
|
+
// if we're connected.
|
|
762
|
+
if (subchannel_data_ != nullptr) {
|
|
763
|
+
// If the subchannel is READY, use it.
|
|
764
|
+
// Otherwise, tell the subchannel list to keep trying.
|
|
765
|
+
if (new_state == GRPC_CHANNEL_READY) {
|
|
766
|
+
Select();
|
|
767
|
+
} else {
|
|
768
|
+
subchannel_data_->OnConnectivityStateChange(new_state, std::move(status));
|
|
769
|
+
}
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
// We aren't trying to connect, so we must be the selected subchannel.
|
|
773
|
+
CHECK(pick_first_->selected_.get() == this);
|
|
774
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
775
|
+
gpr_log(GPR_INFO,
|
|
776
|
+
"Pick First %p selected subchannel connectivity changed to %s",
|
|
777
|
+
pick_first_.get(), ConnectivityStateName(new_state));
|
|
778
|
+
}
|
|
779
|
+
// Any state change is considered to be a failure of the existing
|
|
780
|
+
// connection. Report the failure.
|
|
781
|
+
auto& stats_plugins =
|
|
782
|
+
pick_first_->channel_control_helper()->GetStatsPluginGroup();
|
|
783
|
+
stats_plugins.AddCounter(kMetricDisconnections, 1,
|
|
784
|
+
{pick_first_->channel_control_helper()->GetTarget()},
|
|
785
|
+
{});
|
|
786
|
+
// Report IDLE.
|
|
787
|
+
pick_first_->GoIdle();
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
//
|
|
791
|
+
// PickFirst::SubchannelList::SubchannelData
|
|
792
|
+
//
|
|
793
|
+
|
|
794
|
+
PickFirst::SubchannelList::SubchannelData::SubchannelData(
|
|
795
|
+
SubchannelList* subchannel_list, size_t index,
|
|
796
|
+
RefCountedPtr<SubchannelInterface> subchannel)
|
|
797
|
+
: subchannel_list_(subchannel_list), index_(index) {
|
|
798
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
799
|
+
gpr_log(GPR_INFO,
|
|
800
|
+
"[PF %p] subchannel list %p index %" PRIuPTR
|
|
801
|
+
": creating subchannel data",
|
|
802
|
+
subchannel_list_->policy_.get(), subchannel_list_, index_);
|
|
803
|
+
}
|
|
804
|
+
subchannel_state_ =
|
|
805
|
+
MakeOrphanable<SubchannelState>(this, std::move(subchannel));
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
|
|
809
|
+
grpc_connectivity_state new_state, absl::Status status) {
|
|
810
|
+
PickFirst* p = subchannel_list_->policy_.get();
|
|
811
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
812
|
+
gpr_log(
|
|
813
|
+
GPR_INFO,
|
|
814
|
+
"[PF %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
|
|
815
|
+
" (subchannel_state %p): connectivity changed: old_state=%s, "
|
|
816
|
+
"new_state=%s, status=%s, seen_transient_failure=%d, p->selected_=%p, "
|
|
817
|
+
"p->subchannel_list_=%p, p->subchannel_list_->shutting_down_=%d",
|
|
818
|
+
p, subchannel_list_, index_, subchannel_list_->size(),
|
|
819
|
+
subchannel_state_.get(),
|
|
820
|
+
(connectivity_state_.has_value()
|
|
821
|
+
? ConnectivityStateName(*connectivity_state_)
|
|
822
|
+
: "N/A"),
|
|
823
|
+
ConnectivityStateName(new_state), status.ToString().c_str(),
|
|
824
|
+
seen_transient_failure_, p->selected_.get(), p->subchannel_list_.get(),
|
|
825
|
+
p->subchannel_list_->shutting_down_);
|
|
826
|
+
}
|
|
827
|
+
if (subchannel_list_->shutting_down_) return;
|
|
828
|
+
// The notification must be for a subchannel in the current list.
|
|
829
|
+
CHECK(subchannel_list_ == p->subchannel_list_.get());
|
|
830
|
+
// SHUTDOWN should never happen.
|
|
831
|
+
CHECK(new_state != GRPC_CHANNEL_SHUTDOWN);
|
|
832
|
+
// READY should be caught by SubchannelState, in which case it will
|
|
833
|
+
// not call us in the first place.
|
|
834
|
+
CHECK(new_state != GRPC_CHANNEL_READY);
|
|
835
|
+
// Update state.
|
|
836
|
+
absl::optional<grpc_connectivity_state> old_state = connectivity_state_;
|
|
837
|
+
connectivity_state_ = new_state;
|
|
838
|
+
connectivity_status_ = std::move(status);
|
|
839
|
+
// Make sure we note when a subchannel has seen TRANSIENT_FAILURE.
|
|
840
|
+
bool prev_seen_transient_failure = seen_transient_failure_;
|
|
841
|
+
if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
|
842
|
+
seen_transient_failure_ = true;
|
|
843
|
+
subchannel_list_->last_failure_ = connectivity_status_;
|
|
844
|
+
}
|
|
845
|
+
// If this is the initial connectivity state update for this subchannel,
|
|
846
|
+
// increment the counter in the subchannel list.
|
|
847
|
+
if (!old_state.has_value()) {
|
|
848
|
+
++subchannel_list_->num_subchannels_seen_initial_notification_;
|
|
849
|
+
}
|
|
850
|
+
// If we haven't yet seen the initial connectivity state notification
|
|
851
|
+
// for all subchannels, do nothing.
|
|
852
|
+
if (!subchannel_list_->AllSubchannelsSeenInitialState()) return;
|
|
853
|
+
// If we're still here and this is the initial connectivity state
|
|
854
|
+
// notification for this subchannel, that means it was the last one to
|
|
855
|
+
// see its initial notification. So we now have enough state to
|
|
856
|
+
// figure out how to proceed.
|
|
857
|
+
if (!old_state.has_value()) {
|
|
858
|
+
// If we already have a selected subchannel and we got here, that
|
|
859
|
+
// means that none of the subchannels on the new list are in READY
|
|
860
|
+
// state, which means that the address we're currently connected to
|
|
861
|
+
// is not in the new list. In that case, we drop the current
|
|
862
|
+
// connection and report IDLE.
|
|
863
|
+
if (p->selected_ != nullptr) {
|
|
864
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
865
|
+
gpr_log(GPR_INFO,
|
|
866
|
+
"[PF %p] subchannel list %p: new update has no subchannels in "
|
|
867
|
+
"state READY; dropping existing connection and going IDLE",
|
|
868
|
+
p, subchannel_list_);
|
|
869
|
+
}
|
|
870
|
+
p->GoIdle();
|
|
871
|
+
} else {
|
|
872
|
+
// Start trying to connect, starting with the first subchannel.
|
|
873
|
+
subchannel_list_->StartConnectingNextSubchannel();
|
|
874
|
+
}
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
// We've already started trying to connect. Any subchannel that
|
|
878
|
+
// reports TF is a connection attempt failure.
|
|
879
|
+
if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
|
880
|
+
auto& stats_plugins = subchannel_list_->policy_->channel_control_helper()
|
|
881
|
+
->GetStatsPluginGroup();
|
|
882
|
+
stats_plugins.AddCounter(
|
|
883
|
+
kMetricConnectionAttemptsFailed, 1,
|
|
884
|
+
{subchannel_list_->policy_->channel_control_helper()->GetTarget()}, {});
|
|
885
|
+
}
|
|
886
|
+
// Otherwise, process connectivity state change.
|
|
887
|
+
switch (*connectivity_state_) {
|
|
888
|
+
case GRPC_CHANNEL_TRANSIENT_FAILURE: {
|
|
889
|
+
// If this is the first failure we've seen on this subchannel,
|
|
890
|
+
// then we're still in the Happy Eyeballs pass.
|
|
891
|
+
if (!prev_seen_transient_failure && seen_transient_failure_) {
|
|
892
|
+
// If a connection attempt fails before the timer fires, then
|
|
893
|
+
// cancel the timer and start connecting on the next subchannel.
|
|
894
|
+
if (index_ == subchannel_list_->attempting_index_) {
|
|
895
|
+
if (subchannel_list_->timer_handle_.has_value()) {
|
|
896
|
+
p->channel_control_helper()->GetEventEngine()->Cancel(
|
|
897
|
+
*subchannel_list_->timer_handle_);
|
|
898
|
+
}
|
|
899
|
+
++subchannel_list_->attempting_index_;
|
|
900
|
+
subchannel_list_->StartConnectingNextSubchannel();
|
|
901
|
+
} else {
|
|
902
|
+
// If this was the last subchannel to fail, check if the Happy
|
|
903
|
+
// Eyeballs pass is complete.
|
|
904
|
+
subchannel_list_->MaybeFinishHappyEyeballsPass();
|
|
905
|
+
}
|
|
906
|
+
} else if (subchannel_list_->IsHappyEyeballsPassComplete()) {
|
|
907
|
+
// We're done with the initial Happy Eyeballs pass and in a mode
|
|
908
|
+
// where we're attempting to connect to every subchannel in
|
|
909
|
+
// parallel. We count the number of failed connection attempts,
|
|
910
|
+
// and when that is equal to the number of subchannels, request
|
|
911
|
+
// re-resolution and report TRANSIENT_FAILURE again, so that the
|
|
912
|
+
// caller has the most recent status message. Note that this
|
|
913
|
+
// isn't necessarily the same as saying that we've seen one
|
|
914
|
+
// failure for each subchannel in the list, because the backoff
|
|
915
|
+
// state may be different in each subchannel, so we may have seen
|
|
916
|
+
// one subchannel fail more than once and another subchannel not
|
|
917
|
+
// fail at all. But it's a good enough heuristic.
|
|
918
|
+
++subchannel_list_->num_failures_;
|
|
919
|
+
if (subchannel_list_->num_failures_ % subchannel_list_->size() == 0) {
|
|
920
|
+
p->channel_control_helper()->RequestReresolution();
|
|
921
|
+
status = absl::UnavailableError(absl::StrCat(
|
|
922
|
+
(p->omit_status_message_prefix_
|
|
923
|
+
? ""
|
|
924
|
+
: "failed to connect to all addresses; last error: "),
|
|
925
|
+
connectivity_status_.ToString()));
|
|
926
|
+
p->UpdateState(GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
|
927
|
+
MakeRefCounted<TransientFailurePicker>(status));
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
case GRPC_CHANNEL_IDLE:
|
|
933
|
+
// If we've finished the first Happy Eyeballs pass, then we go
|
|
934
|
+
// into a mode where we immediately try to connect to every
|
|
935
|
+
// subchannel in parallel.
|
|
936
|
+
if (subchannel_list_->IsHappyEyeballsPassComplete()) {
|
|
937
|
+
subchannel_state_->RequestConnection();
|
|
938
|
+
}
|
|
939
|
+
break;
|
|
940
|
+
case GRPC_CHANNEL_CONNECTING:
|
|
941
|
+
// Only update connectivity state only if we're not already in
|
|
942
|
+
// TRANSIENT_FAILURE.
|
|
943
|
+
// TODO(roth): Squelch duplicate CONNECTING updates.
|
|
944
|
+
if (p->state_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
|
945
|
+
p->UpdateState(GRPC_CHANNEL_CONNECTING, absl::Status(),
|
|
946
|
+
MakeRefCounted<QueuePicker>(nullptr));
|
|
947
|
+
}
|
|
948
|
+
break;
|
|
949
|
+
default:
|
|
950
|
+
// We handled READY above, and we should never see SHUTDOWN.
|
|
951
|
+
GPR_UNREACHABLE_CODE(break);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
72
954
|
|
|
73
|
-
|
|
955
|
+
void PickFirst::SubchannelList::SubchannelData::RequestConnectionWithTimer() {
|
|
956
|
+
CHECK(connectivity_state_.has_value());
|
|
957
|
+
if (connectivity_state_ == GRPC_CHANNEL_IDLE) {
|
|
958
|
+
subchannel_state_->RequestConnection();
|
|
959
|
+
} else {
|
|
960
|
+
CHECK(connectivity_state_ == GRPC_CHANNEL_CONNECTING);
|
|
961
|
+
}
|
|
962
|
+
// If this is not the last subchannel in the list, start the timer.
|
|
963
|
+
if (index_ != subchannel_list_->size() - 1) {
|
|
964
|
+
PickFirst* p = subchannel_list_->policy_.get();
|
|
965
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
966
|
+
gpr_log(GPR_INFO,
|
|
967
|
+
"Pick First %p subchannel list %p: starting Connection "
|
|
968
|
+
"Attempt Delay timer for %" PRId64 "ms for index %" PRIuPTR,
|
|
969
|
+
p, subchannel_list_, p->connection_attempt_delay_.millis(),
|
|
970
|
+
index_);
|
|
971
|
+
}
|
|
972
|
+
subchannel_list_->timer_handle_ =
|
|
973
|
+
p->channel_control_helper()->GetEventEngine()->RunAfter(
|
|
974
|
+
p->connection_attempt_delay_,
|
|
975
|
+
[subchannel_list =
|
|
976
|
+
subchannel_list_->Ref(DEBUG_LOCATION, "timer")]() mutable {
|
|
977
|
+
ApplicationCallbackExecCtx application_exec_ctx;
|
|
978
|
+
ExecCtx exec_ctx;
|
|
979
|
+
auto* sl = subchannel_list.get();
|
|
980
|
+
sl->policy_->work_serializer()->Run(
|
|
981
|
+
[subchannel_list = std::move(subchannel_list)]() {
|
|
982
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
983
|
+
gpr_log(GPR_INFO,
|
|
984
|
+
"Pick First %p subchannel list %p: Connection "
|
|
985
|
+
"Attempt Delay timer fired (shutting_down=%d, "
|
|
986
|
+
"selected=%p)",
|
|
987
|
+
subchannel_list->policy_.get(),
|
|
988
|
+
subchannel_list.get(),
|
|
989
|
+
subchannel_list->shutting_down_,
|
|
990
|
+
subchannel_list->policy_->selected_.get());
|
|
991
|
+
}
|
|
992
|
+
if (subchannel_list->shutting_down_) return;
|
|
993
|
+
if (subchannel_list->policy_->selected_ != nullptr) return;
|
|
994
|
+
++subchannel_list->attempting_index_;
|
|
995
|
+
subchannel_list->StartConnectingNextSubchannel();
|
|
996
|
+
},
|
|
997
|
+
DEBUG_LOCATION);
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
74
1001
|
|
|
75
1002
|
//
|
|
76
|
-
//
|
|
1003
|
+
// PickFirst::SubchannelList
|
|
77
1004
|
//
|
|
78
1005
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1006
|
+
PickFirst::SubchannelList::SubchannelList(RefCountedPtr<PickFirst> policy,
|
|
1007
|
+
EndpointAddressesIterator* addresses,
|
|
1008
|
+
const ChannelArgs& args)
|
|
1009
|
+
: InternallyRefCounted<SubchannelList>(
|
|
1010
|
+
GRPC_TRACE_FLAG_ENABLED(pick_first) ? "SubchannelList" : nullptr),
|
|
1011
|
+
policy_(std::move(policy)),
|
|
1012
|
+
args_(args.Remove(GRPC_ARG_INTERNAL_PICK_FIRST_ENABLE_HEALTH_CHECKING)
|
|
1013
|
+
.Remove(
|
|
1014
|
+
GRPC_ARG_INTERNAL_PICK_FIRST_OMIT_STATUS_MESSAGE_PREFIX)) {
|
|
1015
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1016
|
+
gpr_log(GPR_INFO, "[PF %p] Creating subchannel list %p - channel args: %s",
|
|
1017
|
+
policy_.get(), this, args_.ToString().c_str());
|
|
1018
|
+
}
|
|
1019
|
+
if (addresses == nullptr) return;
|
|
1020
|
+
// Create a subchannel for each address.
|
|
1021
|
+
addresses->ForEach([&](const EndpointAddresses& address) {
|
|
1022
|
+
CHECK_EQ(address.addresses().size(), 1u);
|
|
1023
|
+
RefCountedPtr<SubchannelInterface> subchannel =
|
|
1024
|
+
policy_->channel_control_helper()->CreateSubchannel(
|
|
1025
|
+
address.address(), address.args(), args_);
|
|
1026
|
+
if (subchannel == nullptr) {
|
|
1027
|
+
// Subchannel could not be created.
|
|
1028
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1029
|
+
gpr_log(GPR_INFO,
|
|
1030
|
+
"[PF %p] could not create subchannel for address %s, ignoring",
|
|
1031
|
+
policy_.get(), address.ToString().c_str());
|
|
1032
|
+
}
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1036
|
+
gpr_log(GPR_INFO,
|
|
1037
|
+
"[PF %p] subchannel list %p index %" PRIuPTR
|
|
1038
|
+
": Created subchannel %p for address %s",
|
|
1039
|
+
policy_.get(), this, subchannels_.size(), subchannel.get(),
|
|
1040
|
+
address.ToString().c_str());
|
|
1041
|
+
}
|
|
1042
|
+
subchannels_.emplace_back(std::make_unique<SubchannelData>(
|
|
1043
|
+
this, subchannels_.size(), std::move(subchannel)));
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
87
1046
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1047
|
+
PickFirst::SubchannelList::~SubchannelList() {
|
|
1048
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1049
|
+
gpr_log(GPR_INFO, "[PF %p] Destroying subchannel_list %p", policy_.get(),
|
|
1050
|
+
this);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
93
1053
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
1054
|
+
void PickFirst::SubchannelList::Orphan() {
|
|
1055
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1056
|
+
gpr_log(GPR_INFO, "[PF %p] Shutting down subchannel_list %p", policy_.get(),
|
|
1057
|
+
this);
|
|
1058
|
+
}
|
|
1059
|
+
CHECK(!shutting_down_);
|
|
1060
|
+
shutting_down_ = true;
|
|
1061
|
+
// Cancel Happy Eyeballs timer, if any.
|
|
1062
|
+
if (timer_handle_.has_value()) {
|
|
1063
|
+
policy_->channel_control_helper()->GetEventEngine()->Cancel(*timer_handle_);
|
|
1064
|
+
}
|
|
1065
|
+
Unref();
|
|
1066
|
+
}
|
|
99
1067
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
1068
|
+
void PickFirst::SubchannelList::ResetBackoffLocked() {
|
|
1069
|
+
for (auto& sd : subchannels_) {
|
|
1070
|
+
sd->ResetBackoffLocked();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
104
1073
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1074
|
+
void PickFirst::SubchannelList::StartConnectingNextSubchannel() {
|
|
1075
|
+
// Find the next subchannel not in state TRANSIENT_FAILURE.
|
|
1076
|
+
// We skip subchannels in state TRANSIENT_FAILURE to avoid a
|
|
1077
|
+
// large recursion that could overflow the stack.
|
|
1078
|
+
for (; attempting_index_ < size(); ++attempting_index_) {
|
|
1079
|
+
SubchannelData* sc = subchannels_[attempting_index_].get();
|
|
1080
|
+
CHECK(sc->connectivity_state().has_value());
|
|
1081
|
+
if (sc->connectivity_state() != GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
|
1082
|
+
// Found a subchannel not in TRANSIENT_FAILURE, so trigger a
|
|
1083
|
+
// connection attempt.
|
|
1084
|
+
sc->RequestConnectionWithTimer();
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
112
1087
|
}
|
|
1088
|
+
// If we didn't find a subchannel to request a connection on, check to
|
|
1089
|
+
// see if the Happy Eyeballs pass is complete.
|
|
1090
|
+
MaybeFinishHappyEyeballsPass();
|
|
1091
|
+
}
|
|
113
1092
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1093
|
+
void PickFirst::SubchannelList::MaybeFinishHappyEyeballsPass() {
|
|
1094
|
+
// Make sure all subchannels have finished a connection attempt before
|
|
1095
|
+
// we consider the Happy Eyeballs pass complete.
|
|
1096
|
+
if (!IsHappyEyeballsPassComplete()) return;
|
|
1097
|
+
// We didn't find another subchannel not in state TRANSIENT_FAILURE,
|
|
1098
|
+
// so report TRANSIENT_FAILURE and switch to a mode in which we try to
|
|
1099
|
+
// connect to all addresses in parallel.
|
|
1100
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1101
|
+
gpr_log(GPR_INFO,
|
|
1102
|
+
"Pick First %p subchannel list %p failed to connect to "
|
|
1103
|
+
"all subchannels",
|
|
1104
|
+
policy_.get(), this);
|
|
1105
|
+
}
|
|
1106
|
+
// Re-resolve and report TRANSIENT_FAILURE.
|
|
1107
|
+
policy_->channel_control_helper()->RequestReresolution();
|
|
1108
|
+
absl::Status status = absl::UnavailableError(
|
|
1109
|
+
absl::StrCat((policy_->omit_status_message_prefix_
|
|
1110
|
+
? ""
|
|
1111
|
+
: "failed to connect to all addresses; last error: "),
|
|
1112
|
+
last_failure_.ToString()));
|
|
1113
|
+
policy_->UpdateState(GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
|
1114
|
+
MakeRefCounted<TransientFailurePicker>(status));
|
|
1115
|
+
// Drop the existing (working) connection, if any. This may be
|
|
1116
|
+
// sub-optimal, but we can't ignore what the control plane told us.
|
|
1117
|
+
policy_->UnsetSelectedSubchannel();
|
|
1118
|
+
// We now transition into a mode where we try to connect to all
|
|
1119
|
+
// subchannels in parallel. For any subchannel currently in IDLE,
|
|
1120
|
+
// trigger a connection attempt. For any subchannel not currently in
|
|
1121
|
+
// IDLE, we will trigger a connection attempt when it does report IDLE.
|
|
1122
|
+
for (auto& sd : subchannels_) {
|
|
1123
|
+
if (sd->connectivity_state() == GRPC_CHANNEL_IDLE) {
|
|
1124
|
+
sd->RequestConnection();
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
117
1128
|
|
|
118
|
-
|
|
1129
|
+
// TODO(roth): Remove this when the pick_first_new experiment is removed.
|
|
1130
|
+
class OldPickFirst final : public LoadBalancingPolicy {
|
|
119
1131
|
public:
|
|
120
|
-
explicit
|
|
1132
|
+
explicit OldPickFirst(Args args);
|
|
121
1133
|
|
|
122
1134
|
absl::string_view name() const override { return kPickFirst; }
|
|
123
1135
|
|
|
@@ -126,7 +1138,7 @@ class PickFirst final : public LoadBalancingPolicy {
|
|
|
126
1138
|
void ResetBackoffLocked() override;
|
|
127
1139
|
|
|
128
1140
|
private:
|
|
129
|
-
~
|
|
1141
|
+
~OldPickFirst() override;
|
|
130
1142
|
|
|
131
1143
|
class SubchannelList final : public InternallyRefCounted<SubchannelList> {
|
|
132
1144
|
public:
|
|
@@ -211,7 +1223,7 @@ class PickFirst final : public LoadBalancingPolicy {
|
|
|
211
1223
|
bool seen_transient_failure_ = false;
|
|
212
1224
|
};
|
|
213
1225
|
|
|
214
|
-
SubchannelList(RefCountedPtr<
|
|
1226
|
+
SubchannelList(RefCountedPtr<OldPickFirst> policy,
|
|
215
1227
|
EndpointAddressesIterator* addresses,
|
|
216
1228
|
const ChannelArgs& args);
|
|
217
1229
|
|
|
@@ -257,7 +1269,7 @@ class PickFirst final : public LoadBalancingPolicy {
|
|
|
257
1269
|
void MaybeFinishHappyEyeballsPass();
|
|
258
1270
|
|
|
259
1271
|
// Backpointer to owning policy.
|
|
260
|
-
RefCountedPtr<
|
|
1272
|
+
RefCountedPtr<OldPickFirst> policy_;
|
|
261
1273
|
|
|
262
1274
|
ChannelArgs args_;
|
|
263
1275
|
|
|
@@ -290,7 +1302,7 @@ class PickFirst final : public LoadBalancingPolicy {
|
|
|
290
1302
|
class HealthWatcher final
|
|
291
1303
|
: public SubchannelInterface::ConnectivityStateWatcherInterface {
|
|
292
1304
|
public:
|
|
293
|
-
explicit HealthWatcher(RefCountedPtr<
|
|
1305
|
+
explicit HealthWatcher(RefCountedPtr<OldPickFirst> policy)
|
|
294
1306
|
: policy_(std::move(policy)) {}
|
|
295
1307
|
|
|
296
1308
|
~HealthWatcher() override {
|
|
@@ -305,7 +1317,7 @@ class PickFirst final : public LoadBalancingPolicy {
|
|
|
305
1317
|
}
|
|
306
1318
|
|
|
307
1319
|
private:
|
|
308
|
-
RefCountedPtr<
|
|
1320
|
+
RefCountedPtr<OldPickFirst> policy_;
|
|
309
1321
|
};
|
|
310
1322
|
|
|
311
1323
|
class Picker final : public SubchannelPicker {
|
|
@@ -365,7 +1377,7 @@ class PickFirst final : public LoadBalancingPolicy {
|
|
|
365
1377
|
absl::BitGen bit_gen_;
|
|
366
1378
|
};
|
|
367
1379
|
|
|
368
|
-
|
|
1380
|
+
OldPickFirst::OldPickFirst(Args args)
|
|
369
1381
|
: LoadBalancingPolicy(std::move(args)),
|
|
370
1382
|
enable_health_watch_(
|
|
371
1383
|
channel_args()
|
|
@@ -380,21 +1392,21 @@ PickFirst::PickFirst(Args args)
|
|
|
380
1392
|
.GetInt(GRPC_ARG_HAPPY_EYEBALLS_CONNECTION_ATTEMPT_DELAY_MS)
|
|
381
1393
|
.value_or(250),
|
|
382
1394
|
100, 2000))) {
|
|
383
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1395
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
384
1396
|
gpr_log(GPR_INFO, "Pick First %p created.", this);
|
|
385
1397
|
}
|
|
386
1398
|
}
|
|
387
1399
|
|
|
388
|
-
|
|
389
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1400
|
+
OldPickFirst::~OldPickFirst() {
|
|
1401
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
390
1402
|
gpr_log(GPR_INFO, "Destroying Pick First %p", this);
|
|
391
1403
|
}
|
|
392
|
-
|
|
393
|
-
|
|
1404
|
+
CHECK(subchannel_list_ == nullptr);
|
|
1405
|
+
CHECK(latest_pending_subchannel_list_ == nullptr);
|
|
394
1406
|
}
|
|
395
1407
|
|
|
396
|
-
void
|
|
397
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1408
|
+
void OldPickFirst::ShutdownLocked() {
|
|
1409
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
398
1410
|
gpr_log(GPR_INFO, "Pick First %p Shutting down", this);
|
|
399
1411
|
}
|
|
400
1412
|
shutdown_ = true;
|
|
@@ -403,38 +1415,38 @@ void PickFirst::ShutdownLocked() {
|
|
|
403
1415
|
latest_pending_subchannel_list_.reset();
|
|
404
1416
|
}
|
|
405
1417
|
|
|
406
|
-
void
|
|
1418
|
+
void OldPickFirst::ExitIdleLocked() {
|
|
407
1419
|
if (shutdown_) return;
|
|
408
1420
|
if (IsIdle()) {
|
|
409
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1421
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
410
1422
|
gpr_log(GPR_INFO, "Pick First %p exiting idle", this);
|
|
411
1423
|
}
|
|
412
1424
|
AttemptToConnectUsingLatestUpdateArgsLocked();
|
|
413
1425
|
}
|
|
414
1426
|
}
|
|
415
1427
|
|
|
416
|
-
void
|
|
1428
|
+
void OldPickFirst::ResetBackoffLocked() {
|
|
417
1429
|
if (subchannel_list_ != nullptr) subchannel_list_->ResetBackoffLocked();
|
|
418
1430
|
if (latest_pending_subchannel_list_ != nullptr) {
|
|
419
1431
|
latest_pending_subchannel_list_->ResetBackoffLocked();
|
|
420
1432
|
}
|
|
421
1433
|
}
|
|
422
1434
|
|
|
423
|
-
void
|
|
1435
|
+
void OldPickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
424
1436
|
// Create a subchannel list from latest_update_args_.
|
|
425
1437
|
EndpointAddressesIterator* addresses = nullptr;
|
|
426
1438
|
if (latest_update_args_.addresses.ok()) {
|
|
427
1439
|
addresses = latest_update_args_.addresses->get();
|
|
428
1440
|
}
|
|
429
1441
|
// Replace latest_pending_subchannel_list_.
|
|
430
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1442
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first) &&
|
|
431
1443
|
latest_pending_subchannel_list_ != nullptr) {
|
|
432
1444
|
gpr_log(GPR_INFO,
|
|
433
1445
|
"[PF %p] Shutting down previous pending subchannel list %p", this,
|
|
434
1446
|
latest_pending_subchannel_list_.get());
|
|
435
1447
|
}
|
|
436
1448
|
latest_pending_subchannel_list_ = MakeOrphanable<SubchannelList>(
|
|
437
|
-
RefAsSubclass<
|
|
1449
|
+
RefAsSubclass<OldPickFirst>(), addresses, latest_update_args_.args);
|
|
438
1450
|
// Empty update or no valid subchannels. Put the channel in
|
|
439
1451
|
// TRANSIENT_FAILURE and request re-resolution.
|
|
440
1452
|
if (latest_pending_subchannel_list_->size() == 0) {
|
|
@@ -451,8 +1463,7 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
|
451
1463
|
// the current list, replace the current subchannel list immediately.
|
|
452
1464
|
if (latest_pending_subchannel_list_->size() == 0 || selected_ == nullptr) {
|
|
453
1465
|
UnsetSelectedSubchannel();
|
|
454
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
455
|
-
subchannel_list_ != nullptr) {
|
|
1466
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first) && subchannel_list_ != nullptr) {
|
|
456
1467
|
gpr_log(GPR_INFO, "[PF %p] Shutting down previous subchannel list %p",
|
|
457
1468
|
this, subchannel_list_.get());
|
|
458
1469
|
}
|
|
@@ -460,37 +1471,8 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
|
460
1471
|
}
|
|
461
1472
|
}
|
|
462
1473
|
|
|
463
|
-
absl::
|
|
464
|
-
|
|
465
|
-
return absl::string_view(uri_scheme == nullptr ? "other" : uri_scheme);
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
// An endpoint list iterator that returns only entries for a specific
|
|
469
|
-
// address family, as indicated by the URI scheme.
|
|
470
|
-
class AddressFamilyIterator final {
|
|
471
|
-
public:
|
|
472
|
-
AddressFamilyIterator(absl::string_view scheme, size_t index)
|
|
473
|
-
: scheme_(scheme), index_(index) {}
|
|
474
|
-
|
|
475
|
-
EndpointAddresses* Next(EndpointAddressesList& endpoints,
|
|
476
|
-
std::vector<bool>* endpoints_moved) {
|
|
477
|
-
for (; index_ < endpoints.size(); ++index_) {
|
|
478
|
-
if (!(*endpoints_moved)[index_] &&
|
|
479
|
-
GetAddressFamily(endpoints[index_].address()) == scheme_) {
|
|
480
|
-
(*endpoints_moved)[index_] = true;
|
|
481
|
-
return &endpoints[index_++];
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return nullptr;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
private:
|
|
488
|
-
absl::string_view scheme_;
|
|
489
|
-
size_t index_;
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
absl::Status PickFirst::UpdateLocked(UpdateArgs args) {
|
|
493
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
|
1474
|
+
absl::Status OldPickFirst::UpdateLocked(UpdateArgs args) {
|
|
1475
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
494
1476
|
if (args.addresses.ok()) {
|
|
495
1477
|
gpr_log(GPR_INFO, "Pick First %p received update", this);
|
|
496
1478
|
} else {
|
|
@@ -568,14 +1550,14 @@ absl::Status PickFirst::UpdateLocked(UpdateArgs args) {
|
|
|
568
1550
|
return status;
|
|
569
1551
|
}
|
|
570
1552
|
|
|
571
|
-
void
|
|
572
|
-
|
|
573
|
-
|
|
1553
|
+
void OldPickFirst::UpdateState(grpc_connectivity_state state,
|
|
1554
|
+
const absl::Status& status,
|
|
1555
|
+
RefCountedPtr<SubchannelPicker> picker) {
|
|
574
1556
|
state_ = state;
|
|
575
1557
|
channel_control_helper()->UpdateState(state, status, std::move(picker));
|
|
576
1558
|
}
|
|
577
1559
|
|
|
578
|
-
void
|
|
1560
|
+
void OldPickFirst::UnsetSelectedSubchannel() {
|
|
579
1561
|
if (selected_ != nullptr && health_data_watcher_ != nullptr) {
|
|
580
1562
|
selected_->subchannel()->CancelDataWatcher(health_data_watcher_);
|
|
581
1563
|
}
|
|
@@ -585,13 +1567,13 @@ void PickFirst::UnsetSelectedSubchannel() {
|
|
|
585
1567
|
}
|
|
586
1568
|
|
|
587
1569
|
//
|
|
588
|
-
//
|
|
1570
|
+
// OldPickFirst::HealthWatcher
|
|
589
1571
|
//
|
|
590
1572
|
|
|
591
|
-
void
|
|
1573
|
+
void OldPickFirst::HealthWatcher::OnConnectivityStateChange(
|
|
592
1574
|
grpc_connectivity_state new_state, absl::Status status) {
|
|
593
1575
|
if (policy_->health_watcher_ != this) return;
|
|
594
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1576
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
595
1577
|
gpr_log(GPR_INFO, "[PF %p] health watch state update: %s (%s)",
|
|
596
1578
|
policy_.get(), ConnectivityStateName(new_state),
|
|
597
1579
|
status.ToString().c_str());
|
|
@@ -624,16 +1606,16 @@ void PickFirst::HealthWatcher::OnConnectivityStateChange(
|
|
|
624
1606
|
}
|
|
625
1607
|
|
|
626
1608
|
//
|
|
627
|
-
//
|
|
1609
|
+
// OldPickFirst::SubchannelList::SubchannelData
|
|
628
1610
|
//
|
|
629
1611
|
|
|
630
|
-
|
|
1612
|
+
OldPickFirst::SubchannelList::SubchannelData::SubchannelData(
|
|
631
1613
|
SubchannelList* subchannel_list, size_t index,
|
|
632
1614
|
RefCountedPtr<SubchannelInterface> subchannel)
|
|
633
1615
|
: subchannel_list_(subchannel_list),
|
|
634
1616
|
index_(index),
|
|
635
1617
|
subchannel_(std::move(subchannel)) {
|
|
636
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1618
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
637
1619
|
gpr_log(GPR_INFO,
|
|
638
1620
|
"[PF %p] subchannel list %p index %" PRIuPTR
|
|
639
1621
|
" (subchannel %p): starting watch",
|
|
@@ -646,9 +1628,9 @@ PickFirst::SubchannelList::SubchannelData::SubchannelData(
|
|
|
646
1628
|
subchannel_->WatchConnectivityState(std::move(watcher));
|
|
647
1629
|
}
|
|
648
1630
|
|
|
649
|
-
void
|
|
1631
|
+
void OldPickFirst::SubchannelList::SubchannelData::ShutdownLocked() {
|
|
650
1632
|
if (subchannel_ != nullptr) {
|
|
651
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1633
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
652
1634
|
gpr_log(GPR_INFO,
|
|
653
1635
|
"[PF %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
|
|
654
1636
|
" (subchannel %p): cancelling watch and unreffing subchannel",
|
|
@@ -661,10 +1643,10 @@ void PickFirst::SubchannelList::SubchannelData::ShutdownLocked() {
|
|
|
661
1643
|
}
|
|
662
1644
|
}
|
|
663
1645
|
|
|
664
|
-
void
|
|
1646
|
+
void OldPickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
|
|
665
1647
|
grpc_connectivity_state new_state, absl::Status status) {
|
|
666
|
-
|
|
667
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1648
|
+
OldPickFirst* p = subchannel_list_->policy_.get();
|
|
1649
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
668
1650
|
gpr_log(
|
|
669
1651
|
GPR_INFO,
|
|
670
1652
|
"[PF %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
|
|
@@ -683,21 +1665,20 @@ void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
|
|
|
683
1665
|
p->latest_pending_subchannel_list_.get());
|
|
684
1666
|
}
|
|
685
1667
|
if (subchannel_list_->shutting_down_ || pending_watcher_ == nullptr) return;
|
|
686
|
-
auto& stats_plugins =
|
|
687
|
-
|
|
688
|
-
->GetStatsPluginGroup();
|
|
1668
|
+
auto& stats_plugins = subchannel_list_->policy_->channel_control_helper()
|
|
1669
|
+
->GetStatsPluginGroup();
|
|
689
1670
|
// The notification must be for a subchannel in either the current or
|
|
690
1671
|
// latest pending subchannel lists.
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
1672
|
+
CHECK(subchannel_list_ == p->subchannel_list_.get() ||
|
|
1673
|
+
subchannel_list_ == p->latest_pending_subchannel_list_.get());
|
|
1674
|
+
CHECK(new_state != GRPC_CHANNEL_SHUTDOWN);
|
|
694
1675
|
absl::optional<grpc_connectivity_state> old_state = connectivity_state_;
|
|
695
1676
|
connectivity_state_ = new_state;
|
|
696
1677
|
connectivity_status_ = std::move(status);
|
|
697
1678
|
// Handle updates for the currently selected subchannel.
|
|
698
1679
|
if (p->selected_ == this) {
|
|
699
|
-
|
|
700
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1680
|
+
CHECK(subchannel_list_ == p->subchannel_list_.get());
|
|
1681
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
701
1682
|
gpr_log(GPR_INFO,
|
|
702
1683
|
"Pick First %p selected subchannel connectivity changed to %s", p,
|
|
703
1684
|
ConnectivityStateName(new_state));
|
|
@@ -716,7 +1697,7 @@ void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
|
|
|
716
1697
|
p->channel_control_helper()->RequestReresolution();
|
|
717
1698
|
// If there is a pending update, switch to the pending update.
|
|
718
1699
|
if (p->latest_pending_subchannel_list_ != nullptr) {
|
|
719
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1700
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
720
1701
|
gpr_log(GPR_INFO,
|
|
721
1702
|
"Pick First %p promoting pending subchannel list %p to "
|
|
722
1703
|
"replace %p",
|
|
@@ -869,17 +1850,18 @@ void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
|
|
|
869
1850
|
}
|
|
870
1851
|
}
|
|
871
1852
|
|
|
872
|
-
void
|
|
873
|
-
|
|
1853
|
+
void OldPickFirst::SubchannelList::SubchannelData::
|
|
1854
|
+
RequestConnectionWithTimer() {
|
|
1855
|
+
CHECK(connectivity_state_.has_value());
|
|
874
1856
|
if (connectivity_state_ == GRPC_CHANNEL_IDLE) {
|
|
875
1857
|
subchannel_->RequestConnection();
|
|
876
1858
|
} else {
|
|
877
|
-
|
|
1859
|
+
CHECK(connectivity_state_ == GRPC_CHANNEL_CONNECTING);
|
|
878
1860
|
}
|
|
879
1861
|
// If this is not the last subchannel in the list, start the timer.
|
|
880
1862
|
if (index_ != subchannel_list_->size() - 1) {
|
|
881
|
-
|
|
882
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1863
|
+
OldPickFirst* p = subchannel_list_->policy_.get();
|
|
1864
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
883
1865
|
gpr_log(GPR_INFO,
|
|
884
1866
|
"Pick First %p subchannel list %p: starting Connection "
|
|
885
1867
|
"Attempt Delay timer for %" PRId64 "ms for index %" PRIuPTR,
|
|
@@ -896,7 +1878,7 @@ void PickFirst::SubchannelList::SubchannelData::RequestConnectionWithTimer() {
|
|
|
896
1878
|
auto* sl = subchannel_list.get();
|
|
897
1879
|
sl->policy_->work_serializer()->Run(
|
|
898
1880
|
[subchannel_list = std::move(subchannel_list)]() {
|
|
899
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1881
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
900
1882
|
gpr_log(GPR_INFO,
|
|
901
1883
|
"Pick First %p subchannel list %p: Connection "
|
|
902
1884
|
"Attempt Delay timer fired (shutting_down=%d, "
|
|
@@ -916,8 +1898,9 @@ void PickFirst::SubchannelList::SubchannelData::RequestConnectionWithTimer() {
|
|
|
916
1898
|
}
|
|
917
1899
|
}
|
|
918
1900
|
|
|
919
|
-
void
|
|
920
|
-
|
|
1901
|
+
void OldPickFirst::SubchannelList::SubchannelData::
|
|
1902
|
+
ProcessUnselectedReadyLocked() {
|
|
1903
|
+
OldPickFirst* p = subchannel_list_->policy_.get();
|
|
921
1904
|
// Cancel Happy Eyeballs timer, if any.
|
|
922
1905
|
if (subchannel_list_->timer_handle_.has_value()) {
|
|
923
1906
|
p->channel_control_helper()->GetEventEngine()->Cancel(
|
|
@@ -932,11 +1915,11 @@ void PickFirst::SubchannelList::SubchannelData::ProcessUnselectedReadyLocked() {
|
|
|
932
1915
|
// for a subchannel in p->latest_pending_subchannel_list_. The
|
|
933
1916
|
// goal here is to find a subchannel from the update that we can
|
|
934
1917
|
// select in place of the current one.
|
|
935
|
-
|
|
936
|
-
|
|
1918
|
+
CHECK(subchannel_list_ == p->subchannel_list_.get() ||
|
|
1919
|
+
subchannel_list_ == p->latest_pending_subchannel_list_.get());
|
|
937
1920
|
// Case 2. Promote p->latest_pending_subchannel_list_ to p->subchannel_list_.
|
|
938
1921
|
if (subchannel_list_ == p->latest_pending_subchannel_list_.get()) {
|
|
939
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1922
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
940
1923
|
gpr_log(GPR_INFO,
|
|
941
1924
|
"Pick First %p promoting pending subchannel list %p to "
|
|
942
1925
|
"replace %p",
|
|
@@ -947,7 +1930,7 @@ void PickFirst::SubchannelList::SubchannelData::ProcessUnselectedReadyLocked() {
|
|
|
947
1930
|
p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
|
|
948
1931
|
}
|
|
949
1932
|
// Cases 1 and 2.
|
|
950
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1933
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
951
1934
|
gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p,
|
|
952
1935
|
subchannel_.get());
|
|
953
1936
|
}
|
|
@@ -957,11 +1940,11 @@ void PickFirst::SubchannelList::SubchannelData::ProcessUnselectedReadyLocked() {
|
|
|
957
1940
|
// for the health status notification.
|
|
958
1941
|
// If health checking is NOT enabled, report READY.
|
|
959
1942
|
if (p->enable_health_watch_) {
|
|
960
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1943
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
961
1944
|
gpr_log(GPR_INFO, "[PF %p] starting health watch", p);
|
|
962
1945
|
}
|
|
963
1946
|
auto watcher = std::make_unique<HealthWatcher>(
|
|
964
|
-
p->RefAsSubclass<
|
|
1947
|
+
p->RefAsSubclass<OldPickFirst>(DEBUG_LOCATION, "HealthWatcher"));
|
|
965
1948
|
p->health_watcher_ = watcher.get();
|
|
966
1949
|
auto health_data_watcher = MakeHealthCheckWatcher(
|
|
967
1950
|
p->work_serializer(), subchannel_list_->args_, std::move(watcher));
|
|
@@ -980,40 +1963,39 @@ void PickFirst::SubchannelList::SubchannelData::ProcessUnselectedReadyLocked() {
|
|
|
980
1963
|
}
|
|
981
1964
|
|
|
982
1965
|
//
|
|
983
|
-
//
|
|
1966
|
+
// OldPickFirst::SubchannelList
|
|
984
1967
|
//
|
|
985
1968
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1969
|
+
OldPickFirst::SubchannelList::SubchannelList(
|
|
1970
|
+
RefCountedPtr<OldPickFirst> policy, EndpointAddressesIterator* addresses,
|
|
1971
|
+
const ChannelArgs& args)
|
|
989
1972
|
: InternallyRefCounted<SubchannelList>(
|
|
990
|
-
GRPC_TRACE_FLAG_ENABLED(
|
|
991
|
-
: nullptr),
|
|
1973
|
+
GRPC_TRACE_FLAG_ENABLED(pick_first) ? "SubchannelList" : nullptr),
|
|
992
1974
|
policy_(std::move(policy)),
|
|
993
1975
|
args_(args.Remove(GRPC_ARG_INTERNAL_PICK_FIRST_ENABLE_HEALTH_CHECKING)
|
|
994
1976
|
.Remove(
|
|
995
1977
|
GRPC_ARG_INTERNAL_PICK_FIRST_OMIT_STATUS_MESSAGE_PREFIX)) {
|
|
996
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1978
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
997
1979
|
gpr_log(GPR_INFO, "[PF %p] Creating subchannel list %p - channel args: %s",
|
|
998
1980
|
policy_.get(), this, args_.ToString().c_str());
|
|
999
1981
|
}
|
|
1000
1982
|
if (addresses == nullptr) return;
|
|
1001
1983
|
// Create a subchannel for each address.
|
|
1002
1984
|
addresses->ForEach([&](const EndpointAddresses& address) {
|
|
1003
|
-
|
|
1985
|
+
CHECK_EQ(address.addresses().size(), 1u);
|
|
1004
1986
|
RefCountedPtr<SubchannelInterface> subchannel =
|
|
1005
1987
|
policy_->channel_control_helper()->CreateSubchannel(
|
|
1006
1988
|
address.address(), address.args(), args_);
|
|
1007
1989
|
if (subchannel == nullptr) {
|
|
1008
1990
|
// Subchannel could not be created.
|
|
1009
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1991
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1010
1992
|
gpr_log(GPR_INFO,
|
|
1011
1993
|
"[PF %p] could not create subchannel for address %s, ignoring",
|
|
1012
1994
|
policy_.get(), address.ToString().c_str());
|
|
1013
1995
|
}
|
|
1014
1996
|
return;
|
|
1015
1997
|
}
|
|
1016
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
1998
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1017
1999
|
gpr_log(GPR_INFO,
|
|
1018
2000
|
"[PF %p] subchannel list %p index %" PRIuPTR
|
|
1019
2001
|
": Created subchannel %p for address %s",
|
|
@@ -1024,19 +2006,19 @@ PickFirst::SubchannelList::SubchannelList(RefCountedPtr<PickFirst> policy,
|
|
|
1024
2006
|
});
|
|
1025
2007
|
}
|
|
1026
2008
|
|
|
1027
|
-
|
|
1028
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
2009
|
+
OldPickFirst::SubchannelList::~SubchannelList() {
|
|
2010
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1029
2011
|
gpr_log(GPR_INFO, "[PF %p] Destroying subchannel_list %p", policy_.get(),
|
|
1030
2012
|
this);
|
|
1031
2013
|
}
|
|
1032
2014
|
}
|
|
1033
2015
|
|
|
1034
|
-
void
|
|
1035
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
2016
|
+
void OldPickFirst::SubchannelList::Orphan() {
|
|
2017
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1036
2018
|
gpr_log(GPR_INFO, "[PF %p] Shutting down subchannel_list %p", policy_.get(),
|
|
1037
2019
|
this);
|
|
1038
2020
|
}
|
|
1039
|
-
|
|
2021
|
+
CHECK(!shutting_down_);
|
|
1040
2022
|
shutting_down_ = true;
|
|
1041
2023
|
for (auto& sd : subchannels_) {
|
|
1042
2024
|
sd.ShutdownLocked();
|
|
@@ -1047,19 +2029,19 @@ void PickFirst::SubchannelList::Orphan() {
|
|
|
1047
2029
|
Unref();
|
|
1048
2030
|
}
|
|
1049
2031
|
|
|
1050
|
-
void
|
|
2032
|
+
void OldPickFirst::SubchannelList::ResetBackoffLocked() {
|
|
1051
2033
|
for (auto& sd : subchannels_) {
|
|
1052
2034
|
sd.ResetBackoffLocked();
|
|
1053
2035
|
}
|
|
1054
2036
|
}
|
|
1055
2037
|
|
|
1056
|
-
void
|
|
2038
|
+
void OldPickFirst::SubchannelList::StartConnectingNextSubchannel() {
|
|
1057
2039
|
// Find the next subchannel not in state TRANSIENT_FAILURE.
|
|
1058
2040
|
// We skip subchannels in state TRANSIENT_FAILURE to avoid a
|
|
1059
2041
|
// large recursion that could overflow the stack.
|
|
1060
2042
|
for (; attempting_index_ < size(); ++attempting_index_) {
|
|
1061
2043
|
SubchannelData* sc = &subchannels_[attempting_index_];
|
|
1062
|
-
|
|
2044
|
+
CHECK(sc->connectivity_state().has_value());
|
|
1063
2045
|
if (sc->connectivity_state() != GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
|
1064
2046
|
// Found a subchannel not in TRANSIENT_FAILURE, so trigger a
|
|
1065
2047
|
// connection attempt.
|
|
@@ -1072,14 +2054,14 @@ void PickFirst::SubchannelList::StartConnectingNextSubchannel() {
|
|
|
1072
2054
|
MaybeFinishHappyEyeballsPass();
|
|
1073
2055
|
}
|
|
1074
2056
|
|
|
1075
|
-
void
|
|
2057
|
+
void OldPickFirst::SubchannelList::MaybeFinishHappyEyeballsPass() {
|
|
1076
2058
|
// Make sure all subchannels have finished a connection attempt before
|
|
1077
2059
|
// we consider the Happy Eyeballs pass complete.
|
|
1078
2060
|
if (!IsHappyEyeballsPassComplete()) return;
|
|
1079
2061
|
// We didn't find another subchannel not in state TRANSIENT_FAILURE,
|
|
1080
2062
|
// so report TRANSIENT_FAILURE and switch to a mode in which we try to
|
|
1081
2063
|
// connect to all addresses in parallel.
|
|
1082
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
2064
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1083
2065
|
gpr_log(GPR_INFO,
|
|
1084
2066
|
"Pick First %p subchannel list %p failed to connect to "
|
|
1085
2067
|
"all subchannels",
|
|
@@ -1089,7 +2071,7 @@ void PickFirst::SubchannelList::MaybeFinishHappyEyeballsPass() {
|
|
|
1089
2071
|
// TRANSIENT_FAILURE and dropping the existing (working) connection,
|
|
1090
2072
|
// but we can't ignore what the control plane has told us.
|
|
1091
2073
|
if (policy_->latest_pending_subchannel_list_.get() == this) {
|
|
1092
|
-
if (GRPC_TRACE_FLAG_ENABLED(
|
|
2074
|
+
if (GRPC_TRACE_FLAG_ENABLED(pick_first)) {
|
|
1093
2075
|
gpr_log(GPR_INFO,
|
|
1094
2076
|
"Pick First %p promoting pending subchannel list %p to "
|
|
1095
2077
|
"replace %p",
|
|
@@ -1132,6 +2114,9 @@ class PickFirstFactory final : public LoadBalancingPolicyFactory {
|
|
|
1132
2114
|
public:
|
|
1133
2115
|
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
|
|
1134
2116
|
LoadBalancingPolicy::Args args) const override {
|
|
2117
|
+
if (!IsPickFirstNewEnabled()) {
|
|
2118
|
+
return MakeOrphanable<OldPickFirst>(std::move(args));
|
|
2119
|
+
}
|
|
1135
2120
|
return MakeOrphanable<PickFirst>(std::move(args));
|
|
1136
2121
|
}
|
|
1137
2122
|
|