grpc 1.28.0 → 1.30.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +7694 -11190
- data/include/grpc/grpc.h +2 -2
- data/include/grpc/grpc_security.h +22 -9
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/grpc_types.h +19 -21
- data/include/grpc/impl/codegen/port_platform.h +6 -2
- data/include/grpc/module.modulemap +24 -39
- data/src/core/ext/filters/client_channel/backend_metric.cc +7 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +203 -236
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -22
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +17 -10
- data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
- data/src/core/ext/filters/client_channel/lb_policy.h +42 -33
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +240 -301
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +5 -11
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +84 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +834 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -2
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
- data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
- data/src/core/ext/filters/client_channel/resolver.cc +5 -8
- data/src/core/ext/filters/client_channel/resolver.h +12 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +73 -59
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +35 -35
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +16 -20
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +72 -117
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +184 -133
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +7 -4
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +40 -43
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +93 -102
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +32 -5
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -3
- data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +16 -16
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +19 -16
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +20 -31
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +4 -3
- data/src/core/ext/filters/client_channel/server_address.cc +6 -9
- data/src/core/ext/filters/client_channel/server_address.h +6 -12
- data/src/core/ext/filters/client_channel/service_config.cc +104 -144
- data/src/core/ext/filters/client_channel/service_config.h +28 -98
- data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
- data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
- data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +54 -24
- data/src/core/ext/filters/client_channel/subchannel.h +35 -11
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +348 -221
- data/src/core/ext/filters/client_channel/xds/xds_api.h +37 -37
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +44 -49
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +4 -3
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +4 -2
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +532 -339
- data/src/core/ext/filters/client_channel/xds/xds_client.h +57 -22
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +11 -12
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +31 -19
- data/src/core/ext/filters/http/client/http_client_filter.cc +23 -28
- data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
- data/src/core/ext/filters/http/http_filters_plugin.cc +27 -12
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +358 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +7 -10
- data/src/core/ext/filters/message_size/message_size_filter.h +4 -4
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +23 -22
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +14 -21
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +15 -8
- data/src/core/ext/transport/inproc/inproc_transport.cc +19 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +4 -229
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -875
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +418 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +197 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +378 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +21 -8
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +43 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +47 -26
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +115 -65
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +24 -20
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -13
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +38 -18
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +88 -6
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +89 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +9 -6
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +12 -4
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +15 -10
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +16 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +63 -41
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +173 -77
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +48 -28
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +90 -30
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +4 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +1 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +9 -8
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +30 -24
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +21 -20
- data/src/core/ext/upb-generated/validate/validate.upb.h +69 -63
- data/src/core/lib/channel/channel_args.cc +15 -14
- data/src/core/lib/channel/channel_args.h +3 -1
- data/src/core/lib/channel/channel_stack.h +20 -13
- data/src/core/lib/channel/channelz.cc +5 -6
- data/src/core/lib/channel/channelz.h +3 -2
- data/src/core/lib/channel/channelz_registry.cc +5 -3
- data/src/core/lib/channel/connected_channel.cc +7 -5
- data/src/core/lib/channel/context.h +1 -1
- data/src/core/lib/channel/handshaker.cc +11 -13
- data/src/core/lib/channel/handshaker.h +4 -2
- data/src/core/lib/channel/handshaker_registry.cc +5 -17
- data/src/core/lib/channel/status_util.cc +2 -3
- data/src/core/lib/compression/message_compress.cc +5 -1
- data/src/core/lib/debug/stats.cc +21 -27
- data/src/core/lib/debug/stats.h +3 -1
- data/src/core/lib/gpr/spinlock.h +2 -3
- data/src/core/lib/gpr/string.cc +2 -26
- data/src/core/lib/gpr/string.h +0 -16
- data/src/core/lib/gpr/sync_abseil.cc +2 -0
- data/src/core/lib/gpr/time.cc +4 -0
- data/src/core/lib/gpr/time_posix.cc +1 -1
- data/src/core/lib/gprpp/atomic.h +6 -6
- data/src/core/lib/gprpp/fork.cc +1 -1
- data/src/core/lib/gprpp/host_port.cc +29 -35
- data/src/core/lib/gprpp/host_port.h +14 -17
- data/src/core/lib/gprpp/map.h +5 -11
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +2 -3
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/http/parser.h +2 -3
- data/src/core/lib/iomgr/buffer_list.h +22 -21
- data/src/core/lib/iomgr/call_combiner.h +3 -2
- data/src/core/lib/iomgr/cfstream_handle.cc +3 -2
- data/src/core/lib/iomgr/closure.h +2 -3
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/error.cc +6 -9
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/ev_apple.cc +356 -0
- data/src/core/lib/iomgr/ev_apple.h +43 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -23
- data/src/core/lib/iomgr/ev_epollex_linux.cc +2 -3
- data/src/core/lib/iomgr/ev_poll_posix.cc +3 -3
- data/src/core/lib/iomgr/ev_posix.cc +2 -3
- data/src/core/lib/iomgr/exec_ctx.h +14 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
- data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
- data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
- data/src/core/lib/iomgr/port.h +1 -0
- data/src/core/lib/iomgr/python_util.h +46 -0
- data/src/core/lib/iomgr/resolve_address.h +4 -6
- data/src/core/lib/iomgr/resolve_address_custom.cc +29 -39
- data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -17
- data/src/core/lib/iomgr/resource_quota.cc +4 -6
- data/src/core/lib/iomgr/sockaddr_utils.cc +23 -29
- data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
- data/src/core/lib/iomgr/socket_mutator.h +2 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +7 -26
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -7
- data/src/core/lib/iomgr/tcp_client_posix.cc +8 -5
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
- data/src/core/lib/iomgr/tcp_custom.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -9
- data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
- data/src/core/lib/iomgr/tcp_uv.cc +3 -2
- data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
- data/src/core/lib/iomgr/timer_generic.cc +2 -3
- data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
- data/src/core/lib/iomgr/timer_heap.h +2 -3
- data/src/core/lib/iomgr/udp_server.cc +9 -14
- data/src/core/lib/json/json.h +3 -2
- data/src/core/lib/json/json_reader.cc +5 -5
- data/src/core/lib/json/json_writer.cc +13 -12
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
- data/src/core/lib/security/credentials/credentials.cc +0 -84
- data/src/core/lib/security/credentials/credentials.h +8 -59
- data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -8
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
- data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -15
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +55 -27
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +9 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +13 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +38 -11
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -7
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +20 -25
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -6
- data/src/core/lib/security/security_connector/ssl_utils.cc +59 -12
- data/src/core/lib/security/security_connector/ssl_utils.h +12 -10
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +77 -51
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +27 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
- data/src/core/lib/slice/slice_intern.cc +2 -3
- data/src/core/lib/slice/slice_internal.h +14 -0
- data/src/core/lib/slice/slice_utils.h +9 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
- data/src/core/lib/surface/call.cc +2 -3
- data/src/core/lib/surface/call_log_batch.cc +50 -58
- data/src/core/lib/surface/channel.cc +53 -31
- data/src/core/lib/surface/channel.h +35 -4
- data/src/core/lib/surface/channel_ping.cc +2 -3
- data/src/core/lib/surface/completion_queue.cc +33 -33
- data/src/core/lib/surface/event_string.cc +18 -25
- data/src/core/lib/surface/event_string.h +3 -1
- data/src/core/lib/surface/init_secure.cc +1 -4
- data/src/core/lib/surface/server.cc +570 -369
- data/src/core/lib/surface/server.h +32 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +7 -2
- data/src/core/lib/transport/connectivity_state.cc +7 -6
- data/src/core/lib/transport/connectivity_state.h +5 -3
- data/src/core/lib/transport/metadata.cc +3 -3
- data/src/core/lib/transport/metadata_batch.h +2 -3
- data/src/core/lib/transport/static_metadata.h +1 -1
- data/src/core/lib/transport/status_conversion.cc +6 -14
- data/src/core/lib/transport/transport.cc +2 -3
- data/src/core/lib/transport/transport.h +3 -2
- data/src/core/lib/transport/transport_op_string.cc +61 -102
- data/src/core/lib/uri/uri_parser.h +2 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +8 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +32 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
- data/src/core/tsi/fake_transport_security.cc +10 -15
- data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
- data/src/core/tsi/ssl_transport_security.cc +52 -39
- data/src/core/tsi/ssl_transport_security.h +8 -8
- data/src/core/tsi/ssl_types.h +0 -2
- data/src/core/tsi/transport_security.h +6 -9
- data/src/core/tsi/transport_security_grpc.h +2 -3
- data/src/core/tsi/transport_security_interface.h +3 -3
- data/src/ruby/ext/grpc/rb_call.c +9 -1
- data/src/ruby/lib/grpc/errors.rb +103 -42
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
- data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
- data/src/ruby/lib/grpc/generic/service.rb +5 -4
- data/src/ruby/lib/grpc/structs.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +5 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -0
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
- data/third_party/abseil-cpp/absl/time/clock.h +74 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
- data/third_party/abseil-cpp/absl/time/format.cc +153 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
- data/third_party/abseil-cpp/absl/time/time.cc +499 -0
- data/third_party/abseil-cpp/absl/time/time.h +1584 -0
- data/third_party/boringssl-with-bazel/err_data.c +329 -297
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +14 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +432 -160
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -12
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +172 -77
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +5 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +14 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +28 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +12 -4
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +64 -47
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +6 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +64 -5
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +6 -2
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -27
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +50 -20
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
- metadata +111 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
- data/src/core/lib/gprpp/string_view.h +0 -60
- data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
#include <set>
|
27
27
|
|
28
|
+
#include "absl/container/inlined_vector.h"
|
28
29
|
#include "absl/types/optional.h"
|
29
30
|
|
30
31
|
#include <grpc/slice_buffer.h>
|
@@ -45,11 +46,34 @@ class XdsApi {
|
|
45
46
|
static const char* kEdsTypeUrl;
|
46
47
|
|
47
48
|
struct RdsUpdate {
|
48
|
-
|
49
|
-
|
49
|
+
struct RdsRoute {
|
50
|
+
std::string service;
|
51
|
+
std::string method;
|
52
|
+
// TODO(donnadionne): When we can use absl::variant<>, consider using that
|
53
|
+
// here, to enforce the fact that only one of cluster_name and
|
54
|
+
// weighted_clusters can be set.
|
55
|
+
std::string cluster_name;
|
56
|
+
struct ClusterWeight {
|
57
|
+
std::string name;
|
58
|
+
uint32_t weight;
|
59
|
+
|
60
|
+
bool operator==(const ClusterWeight& other) const {
|
61
|
+
return (name == other.name && weight == other.weight);
|
62
|
+
}
|
63
|
+
};
|
64
|
+
std::vector<ClusterWeight> weighted_clusters;
|
65
|
+
|
66
|
+
bool operator==(const RdsRoute& other) const {
|
67
|
+
return (service == other.service && method == other.method &&
|
68
|
+
cluster_name == other.cluster_name &&
|
69
|
+
weighted_clusters == other.weighted_clusters);
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
std::vector<RdsRoute> routes;
|
50
74
|
|
51
75
|
bool operator==(const RdsUpdate& other) const {
|
52
|
-
return
|
76
|
+
return routes == other.routes;
|
53
77
|
}
|
54
78
|
};
|
55
79
|
|
@@ -140,7 +164,7 @@ class XdsApi {
|
|
140
164
|
}
|
141
165
|
|
142
166
|
private:
|
143
|
-
InlinedVector<LocalityMap, 2> priorities_;
|
167
|
+
absl::InlinedVector<LocalityMap, 2> priorities_;
|
144
168
|
};
|
145
169
|
|
146
170
|
// There are two phases of accessing this class's content:
|
@@ -159,7 +183,7 @@ class XdsApi {
|
|
159
183
|
const uint32_t parts_per_million;
|
160
184
|
};
|
161
185
|
|
162
|
-
using DropCategoryList = InlinedVector<DropCategory, 2>;
|
186
|
+
using DropCategoryList = absl::InlinedVector<DropCategory, 2>;
|
163
187
|
|
164
188
|
void AddCategory(std::string name, uint32_t parts_per_million) {
|
165
189
|
drop_category_list_.emplace_back(
|
@@ -206,36 +230,10 @@ class XdsApi {
|
|
206
230
|
|
207
231
|
XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node);
|
208
232
|
|
209
|
-
// Creates
|
210
|
-
// Takes ownership of \a error.
|
211
|
-
grpc_slice CreateUnsupportedTypeNackRequest(const std::string& type_url,
|
212
|
-
const std::string& nonce,
|
213
|
-
grpc_error* error);
|
214
|
-
|
215
|
-
// Creates an LDS request querying \a server_name.
|
216
|
-
// Takes ownership of \a error.
|
217
|
-
grpc_slice CreateLdsRequest(const std::string& server_name,
|
218
|
-
const std::string& version,
|
219
|
-
const std::string& nonce, grpc_error* error,
|
220
|
-
bool populate_node);
|
221
|
-
|
222
|
-
// Creates an RDS request querying \a route_config_name.
|
223
|
-
// Takes ownership of \a error.
|
224
|
-
grpc_slice CreateRdsRequest(const std::string& route_config_name,
|
225
|
-
const std::string& version,
|
226
|
-
const std::string& nonce, grpc_error* error,
|
227
|
-
bool populate_node);
|
228
|
-
|
229
|
-
// Creates a CDS request querying \a cluster_names.
|
230
|
-
// Takes ownership of \a error.
|
231
|
-
grpc_slice CreateCdsRequest(const std::set<StringView>& cluster_names,
|
232
|
-
const std::string& version,
|
233
|
-
const std::string& nonce, grpc_error* error,
|
234
|
-
bool populate_node);
|
235
|
-
|
236
|
-
// Creates an EDS request querying \a eds_service_names.
|
233
|
+
// Creates an ADS request.
|
237
234
|
// Takes ownership of \a error.
|
238
|
-
grpc_slice
|
235
|
+
grpc_slice CreateAdsRequest(const std::string& type_url,
|
236
|
+
const std::set<absl::string_view>& resource_names,
|
239
237
|
const std::string& version,
|
240
238
|
const std::string& nonce, grpc_error* error,
|
241
239
|
bool populate_node);
|
@@ -246,9 +244,9 @@ class XdsApi {
|
|
246
244
|
grpc_error* ParseAdsResponse(
|
247
245
|
const grpc_slice& encoded_response,
|
248
246
|
const std::string& expected_server_name,
|
249
|
-
const std::
|
250
|
-
const std::set<
|
251
|
-
const std::set<
|
247
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
248
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
249
|
+
const std::set<absl::string_view>& expected_eds_service_names,
|
252
250
|
absl::optional<LdsUpdate>* lds_update,
|
253
251
|
absl::optional<RdsUpdate>* rds_update, CdsUpdateMap* cds_update_map,
|
254
252
|
EdsUpdateMap* eds_update_map, std::string* version, std::string* nonce,
|
@@ -264,12 +262,14 @@ class XdsApi {
|
|
264
262
|
// load_reporting_interval for client-side load reporting. If there is any
|
265
263
|
// error, the output config is invalid.
|
266
264
|
grpc_error* ParseLrsResponse(const grpc_slice& encoded_response,
|
265
|
+
bool* send_all_clusters,
|
267
266
|
std::set<std::string>* cluster_names,
|
268
267
|
grpc_millis* load_reporting_interval);
|
269
268
|
|
270
269
|
private:
|
271
270
|
XdsClient* client_;
|
272
271
|
TraceFlag* tracer_;
|
272
|
+
const bool xds_routing_enabled_;
|
273
273
|
const XdsBootstrap::Node* node_;
|
274
274
|
const std::string build_version_;
|
275
275
|
const std::string user_agent_name_;
|
@@ -18,12 +18,19 @@
|
|
18
18
|
|
19
19
|
#include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h"
|
20
20
|
|
21
|
+
#include <vector>
|
22
|
+
|
21
23
|
#include <errno.h>
|
22
24
|
#include <stdlib.h>
|
23
25
|
|
26
|
+
#include "absl/strings/str_format.h"
|
27
|
+
#include "absl/strings/str_join.h"
|
28
|
+
#include "absl/strings/string_view.h"
|
29
|
+
|
24
30
|
#include <grpc/support/string_util.h>
|
25
31
|
|
26
32
|
#include "src/core/lib/gpr/env.h"
|
33
|
+
#include "src/core/lib/gpr/string.h"
|
27
34
|
#include "src/core/lib/iomgr/load_file.h"
|
28
35
|
#include "src/core/lib/slice/slice_internal.h"
|
29
36
|
|
@@ -31,47 +38,36 @@ namespace grpc_core {
|
|
31
38
|
|
32
39
|
namespace {
|
33
40
|
|
34
|
-
|
35
|
-
|
36
|
-
gpr_strvec_init(&v);
|
37
|
-
char* tmp;
|
41
|
+
std::string BootstrapString(const XdsBootstrap& bootstrap) {
|
42
|
+
std::vector<std::string> parts;
|
38
43
|
if (bootstrap.node() != nullptr) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
bootstrap.node()->locality_zone.c_str(),
|
54
|
-
bootstrap.node()->locality_subzone.c_str(),
|
55
|
-
bootstrap.node()->metadata.Dump().c_str());
|
56
|
-
gpr_strvec_add(&v, tmp);
|
44
|
+
parts.push_back(absl::StrFormat(
|
45
|
+
"node={\n"
|
46
|
+
" id=\"%s\",\n"
|
47
|
+
" cluster=\"%s\",\n"
|
48
|
+
" locality={\n"
|
49
|
+
" region=\"%s\",\n"
|
50
|
+
" zone=\"%s\",\n"
|
51
|
+
" subzone=\"%s\"\n"
|
52
|
+
" },\n"
|
53
|
+
" metadata=%s,\n"
|
54
|
+
"},\n",
|
55
|
+
bootstrap.node()->id, bootstrap.node()->cluster,
|
56
|
+
bootstrap.node()->locality_region, bootstrap.node()->locality_zone,
|
57
|
+
bootstrap.node()->locality_subzone, bootstrap.node()->metadata.Dump()));
|
57
58
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
gpr_asprintf(&tmp, " {type=\"%s\", config=%s},\n", creds.type.c_str(),
|
68
|
-
creds.config.Dump().c_str());
|
69
|
-
gpr_strvec_add(&v, tmp);
|
59
|
+
parts.push_back(
|
60
|
+
absl::StrFormat("servers=[\n"
|
61
|
+
" {\n"
|
62
|
+
" uri=\"%s\",\n"
|
63
|
+
" creds=[\n",
|
64
|
+
bootstrap.server().server_uri));
|
65
|
+
for (const auto& creds : bootstrap.server().channel_creds) {
|
66
|
+
parts.push_back(absl::StrFormat(" {type=\"%s\", config=%s},\n",
|
67
|
+
creds.type, creds.config.Dump()));
|
70
68
|
}
|
71
|
-
|
72
|
-
|
73
|
-
gpr_strvec_destroy(&v);
|
74
|
-
return result;
|
69
|
+
parts.push_back(" ]\n }\n]");
|
70
|
+
return absl::StrJoin(parts, "");
|
75
71
|
}
|
76
72
|
|
77
73
|
} // namespace
|
@@ -94,11 +90,10 @@ std::unique_ptr
|
|
94
90
|
grpc_slice contents;
|
95
91
|
*error = grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents);
|
96
92
|
if (*error != GRPC_ERROR_NONE) return nullptr;
|
97
|
-
|
93
|
+
absl::string_view contents_str_view = StringViewFromSlice(contents);
|
98
94
|
if (GRPC_TRACE_FLAG_ENABLED(*tracer)) {
|
99
|
-
UniquePtr<char> str = StringViewToCString(contents_str_view);
|
100
95
|
gpr_log(GPR_DEBUG, "[xds_client %p] Bootstrap file contents: %s", client,
|
101
|
-
|
96
|
+
std::string(contents_str_view).c_str());
|
102
97
|
}
|
103
98
|
Json json = Json::Parse(contents_str_view, error);
|
104
99
|
grpc_slice_unref_internal(contents);
|
@@ -117,7 +112,7 @@ std::unique_ptr
|
|
117
112
|
if (*error == GRPC_ERROR_NONE && GRPC_TRACE_FLAG_ENABLED(*tracer)) {
|
118
113
|
gpr_log(GPR_INFO,
|
119
114
|
"[xds_client %p] Bootstrap config for creating xds client:\n%s",
|
120
|
-
client, BootstrapString(*result).
|
115
|
+
client, BootstrapString(*result).c_str());
|
121
116
|
}
|
122
117
|
return result;
|
123
118
|
}
|
@@ -128,7 +123,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {
|
|
128
123
|
"malformed JSON in bootstrap file");
|
129
124
|
return;
|
130
125
|
}
|
131
|
-
|
126
|
+
std::vector<grpc_error*> error_list;
|
132
127
|
auto it = json.mutable_object()->find("xds_servers");
|
133
128
|
if (it == json.mutable_object()->end()) {
|
134
129
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
@@ -155,7 +150,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {
|
|
155
150
|
}
|
156
151
|
|
157
152
|
grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) {
|
158
|
-
|
153
|
+
std::vector<grpc_error*> error_list;
|
159
154
|
for (size_t i = 0; i < json->mutable_array()->size(); ++i) {
|
160
155
|
Json& child = json->mutable_array()->at(i);
|
161
156
|
if (child.type() != Json::Type::OBJECT) {
|
@@ -173,7 +168,7 @@ grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) {
|
|
173
168
|
}
|
174
169
|
|
175
170
|
grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) {
|
176
|
-
|
171
|
+
std::vector<grpc_error*> error_list;
|
177
172
|
servers_.emplace_back();
|
178
173
|
XdsServer& server = servers_[servers_.size() - 1];
|
179
174
|
auto it = json->mutable_object()->find("server_uri");
|
@@ -211,7 +206,7 @@ grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) {
|
|
211
206
|
|
212
207
|
grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json,
|
213
208
|
XdsServer* server) {
|
214
|
-
|
209
|
+
std::vector<grpc_error*> error_list;
|
215
210
|
for (size_t i = 0; i < json->mutable_array()->size(); ++i) {
|
216
211
|
Json& child = json->mutable_array()->at(i);
|
217
212
|
if (child.type() != Json::Type::OBJECT) {
|
@@ -230,7 +225,7 @@ grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json,
|
|
230
225
|
|
231
226
|
grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx,
|
232
227
|
XdsServer* server) {
|
233
|
-
|
228
|
+
std::vector<grpc_error*> error_list;
|
234
229
|
ChannelCreds channel_creds;
|
235
230
|
auto it = json->mutable_object()->find("type");
|
236
231
|
if (it == json->mutable_object()->end()) {
|
@@ -268,7 +263,7 @@ grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx,
|
|
268
263
|
}
|
269
264
|
|
270
265
|
grpc_error* XdsBootstrap::ParseNode(Json* json) {
|
271
|
-
|
266
|
+
std::vector<grpc_error*> error_list;
|
272
267
|
node_ = absl::make_unique<Node>();
|
273
268
|
auto it = json->mutable_object()->find("id");
|
274
269
|
if (it != json->mutable_object()->end()) {
|
@@ -312,7 +307,7 @@ grpc_error* XdsBootstrap::ParseNode(Json* json) {
|
|
312
307
|
}
|
313
308
|
|
314
309
|
grpc_error* XdsBootstrap::ParseLocality(Json* json) {
|
315
|
-
|
310
|
+
std::vector<grpc_error*> error_list;
|
316
311
|
auto it = json->mutable_object()->find("region");
|
317
312
|
if (it != json->mutable_object()->end()) {
|
318
313
|
if (it->second.type() != Json::Type::STRING) {
|
@@ -23,9 +23,10 @@
|
|
23
23
|
#include <string>
|
24
24
|
#include <vector>
|
25
25
|
|
26
|
+
#include "absl/container/inlined_vector.h"
|
27
|
+
|
26
28
|
#include <grpc/impl/codegen/slice.h>
|
27
29
|
|
28
|
-
#include "src/core/lib/gprpp/inlined_vector.h"
|
29
30
|
#include "src/core/lib/gprpp/map.h"
|
30
31
|
#include "src/core/lib/gprpp/memory.h"
|
31
32
|
#include "src/core/lib/iomgr/error.h"
|
@@ -53,7 +54,7 @@ class XdsBootstrap {
|
|
53
54
|
|
54
55
|
struct XdsServer {
|
55
56
|
std::string server_uri;
|
56
|
-
InlinedVector<ChannelCreds, 1> channel_creds;
|
57
|
+
absl::InlinedVector<ChannelCreds, 1> channel_creds;
|
57
58
|
};
|
58
59
|
|
59
60
|
// If *error is not GRPC_ERROR_NONE after returning, then there was an
|
@@ -78,7 +79,7 @@ class XdsBootstrap {
|
|
78
79
|
grpc_error* ParseNode(Json* json);
|
79
80
|
grpc_error* ParseLocality(Json* json);
|
80
81
|
|
81
|
-
InlinedVector<XdsServer, 1> servers_;
|
82
|
+
absl::InlinedVector<XdsServer, 1> servers_;
|
82
83
|
std::unique_ptr<Node> node_;
|
83
84
|
};
|
84
85
|
|
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include "absl/container/inlined_vector.h"
|
26
|
+
|
25
27
|
#include <grpc/grpc_security.h>
|
26
28
|
#include <grpc/support/alloc.h>
|
27
29
|
#include <grpc/support/string_util.h>
|
@@ -39,8 +41,8 @@
|
|
39
41
|
namespace grpc_core {
|
40
42
|
|
41
43
|
grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
|
42
|
-
InlinedVector<const char*, 1> args_to_remove;
|
43
|
-
InlinedVector<grpc_arg, 2> args_to_add;
|
44
|
+
absl::InlinedVector<const char*, 1> args_to_remove;
|
45
|
+
absl::InlinedVector<grpc_arg, 2> args_to_add;
|
44
46
|
// Substitute the channel credentials with a version without call
|
45
47
|
// credentials: the load balancer is not necessarily trusted to handle
|
46
48
|
// bearer token credentials.
|
@@ -22,7 +22,10 @@
|
|
22
22
|
#include <limits.h>
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include "absl/container/inlined_vector.h"
|
26
|
+
#include "absl/strings/str_format.h"
|
25
27
|
#include "absl/strings/str_join.h"
|
28
|
+
#include "absl/strings/string_view.h"
|
26
29
|
|
27
30
|
#include <grpc/byte_buffer_reader.h>
|
28
31
|
#include <grpc/grpc.h>
|
@@ -48,10 +51,10 @@
|
|
48
51
|
#include "src/core/lib/gprpp/orphanable.h"
|
49
52
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
50
53
|
#include "src/core/lib/gprpp/sync.h"
|
51
|
-
#include "src/core/lib/iomgr/combiner.h"
|
52
54
|
#include "src/core/lib/iomgr/sockaddr.h"
|
53
55
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
54
56
|
#include "src/core/lib/iomgr/timer.h"
|
57
|
+
#include "src/core/lib/iomgr/work_serializer.h"
|
55
58
|
#include "src/core/lib/slice/slice_hash_table.h"
|
56
59
|
#include "src/core/lib/slice/slice_internal.h"
|
57
60
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
@@ -95,7 +98,7 @@ class XdsClient::ChannelState::RetryableCall
|
|
95
98
|
void StartNewCallLocked();
|
96
99
|
void StartRetryTimerLocked();
|
97
100
|
static void OnRetryTimer(void* arg, grpc_error* error);
|
98
|
-
|
101
|
+
void OnRetryTimerLocked(grpc_error* error);
|
99
102
|
|
100
103
|
// The wrapped xds call that talks to the xds server. It's instantiated
|
101
104
|
// every time we start a new call. It's null during call retry backoff.
|
@@ -169,51 +172,48 @@ class XdsClient::ChannelState::AdsCallState
|
|
169
172
|
private:
|
170
173
|
static void OnTimer(void* arg, grpc_error* error) {
|
171
174
|
ResourceState* self = static_cast<ResourceState*>(arg);
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
GRPC_ERROR_REF(error));
|
175
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
176
|
+
self->ads_calld_->xds_client()->work_serializer_->Run(
|
177
|
+
[self, error]() { self->OnTimerLocked(error); }, DEBUG_LOCATION);
|
176
178
|
}
|
177
179
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
self->timer_pending_ = false;
|
180
|
+
void OnTimerLocked(grpc_error* error) {
|
181
|
+
if (error == GRPC_ERROR_NONE && timer_pending_) {
|
182
|
+
timer_pending_ = false;
|
182
183
|
char* msg;
|
183
184
|
gpr_asprintf(
|
184
185
|
&msg,
|
185
186
|
"timeout obtaining resource {type=%s name=%s} from xds server",
|
186
|
-
|
187
|
-
grpc_error*
|
187
|
+
type_url_.c_str(), name_.c_str());
|
188
|
+
grpc_error* watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
188
189
|
gpr_free(msg);
|
189
190
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
190
|
-
gpr_log(GPR_INFO, "[xds_client %p] %s",
|
191
|
-
|
191
|
+
gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
|
192
|
+
grpc_error_string(watcher_error));
|
192
193
|
}
|
193
|
-
if (
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
} else if (
|
198
|
-
ClusterState& state =
|
199
|
-
self->ads_calld_->xds_client()->cluster_map_[self->name_];
|
194
|
+
if (type_url_ == XdsApi::kLdsTypeUrl ||
|
195
|
+
type_url_ == XdsApi::kRdsTypeUrl) {
|
196
|
+
ads_calld_->xds_client()->service_config_watcher_->OnError(
|
197
|
+
watcher_error);
|
198
|
+
} else if (type_url_ == XdsApi::kCdsTypeUrl) {
|
199
|
+
ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
|
200
200
|
for (const auto& p : state.watchers) {
|
201
|
-
p.first->OnError(GRPC_ERROR_REF(
|
201
|
+
p.first->OnError(GRPC_ERROR_REF(watcher_error));
|
202
202
|
}
|
203
|
-
GRPC_ERROR_UNREF(
|
204
|
-
} else if (
|
205
|
-
EndpointState& state =
|
206
|
-
self->ads_calld_->xds_client()->endpoint_map_[self->name_];
|
203
|
+
GRPC_ERROR_UNREF(watcher_error);
|
204
|
+
} else if (type_url_ == XdsApi::kEdsTypeUrl) {
|
205
|
+
EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
|
207
206
|
for (const auto& p : state.watchers) {
|
208
|
-
p.first->OnError(GRPC_ERROR_REF(
|
207
|
+
p.first->OnError(GRPC_ERROR_REF(watcher_error));
|
209
208
|
}
|
210
|
-
GRPC_ERROR_UNREF(
|
209
|
+
GRPC_ERROR_UNREF(watcher_error);
|
211
210
|
} else {
|
212
211
|
GPR_UNREACHABLE_CODE(return );
|
213
212
|
}
|
214
213
|
}
|
215
|
-
|
216
|
-
|
214
|
+
ads_calld_.reset();
|
215
|
+
Unref();
|
216
|
+
GRPC_ERROR_UNREF(error);
|
217
217
|
}
|
218
218
|
|
219
219
|
const std::string type_url_;
|
@@ -247,16 +247,16 @@ class XdsClient::ChannelState::AdsCallState
|
|
247
247
|
void AcceptEdsUpdate(XdsApi::EdsUpdateMap eds_update_map);
|
248
248
|
|
249
249
|
static void OnRequestSent(void* arg, grpc_error* error);
|
250
|
-
|
250
|
+
void OnRequestSentLocked(grpc_error* error);
|
251
251
|
static void OnResponseReceived(void* arg, grpc_error* error);
|
252
|
-
|
252
|
+
void OnResponseReceivedLocked();
|
253
253
|
static void OnStatusReceived(void* arg, grpc_error* error);
|
254
|
-
|
254
|
+
void OnStatusReceivedLocked(grpc_error* error);
|
255
255
|
|
256
256
|
bool IsCurrentCallOnChannel() const;
|
257
257
|
|
258
|
-
std::set<
|
259
|
-
|
258
|
+
std::set<absl::string_view> ResourceNamesForRequest(
|
259
|
+
const std::string& type_url);
|
260
260
|
|
261
261
|
// The owning RetryableCall<>.
|
262
262
|
RefCountedPtr<RetryableCall<AdsCallState>> parent_;
|
@@ -314,6 +314,10 @@ class XdsClient::ChannelState::LrsCallState
|
|
314
314
|
public:
|
315
315
|
Reporter(RefCountedPtr<LrsCallState> parent, grpc_millis report_interval)
|
316
316
|
: parent_(std::move(parent)), report_interval_(report_interval) {
|
317
|
+
GRPC_CLOSURE_INIT(&on_next_report_timer_, OnNextReportTimer, this,
|
318
|
+
grpc_schedule_on_exec_ctx);
|
319
|
+
GRPC_CLOSURE_INIT(&on_report_done_, OnReportDone, this,
|
320
|
+
grpc_schedule_on_exec_ctx);
|
317
321
|
ScheduleNextReportLocked();
|
318
322
|
}
|
319
323
|
|
@@ -322,10 +326,10 @@ class XdsClient::ChannelState::LrsCallState
|
|
322
326
|
private:
|
323
327
|
void ScheduleNextReportLocked();
|
324
328
|
static void OnNextReportTimer(void* arg, grpc_error* error);
|
325
|
-
|
329
|
+
void OnNextReportTimerLocked(grpc_error* error);
|
326
330
|
void SendReportLocked();
|
327
331
|
static void OnReportDone(void* arg, grpc_error* error);
|
328
|
-
|
332
|
+
void OnReportDoneLocked(grpc_error* error);
|
329
333
|
|
330
334
|
bool IsCurrentReporterOnCall() const {
|
331
335
|
return this == parent_->reporter_.get();
|
@@ -345,11 +349,11 @@ class XdsClient::ChannelState::LrsCallState
|
|
345
349
|
};
|
346
350
|
|
347
351
|
static void OnInitialRequestSent(void* arg, grpc_error* error);
|
352
|
+
void OnInitialRequestSentLocked();
|
348
353
|
static void OnResponseReceived(void* arg, grpc_error* error);
|
354
|
+
void OnResponseReceivedLocked();
|
349
355
|
static void OnStatusReceived(void* arg, grpc_error* error);
|
350
|
-
|
351
|
-
static void OnResponseReceivedLocked(void* arg, grpc_error* error);
|
352
|
-
static void OnStatusReceivedLocked(void* arg, grpc_error* error);
|
356
|
+
void OnStatusReceivedLocked(grpc_error* error);
|
353
357
|
|
354
358
|
bool IsCurrentCallOnChannel() const;
|
355
359
|
|
@@ -378,6 +382,7 @@ class XdsClient::ChannelState::LrsCallState
|
|
378
382
|
grpc_closure on_status_received_;
|
379
383
|
|
380
384
|
// Load reporting state.
|
385
|
+
bool send_all_clusters_ = false;
|
381
386
|
std::set<std::string> cluster_names_; // Asked for by the LRS server.
|
382
387
|
grpc_millis load_reporting_interval_ = 0;
|
383
388
|
OrphanablePtr<Reporter> reporter_;
|
@@ -391,7 +396,8 @@ class XdsClient::ChannelState::StateWatcher
|
|
391
396
|
: public AsyncConnectivityStateWatcherInterface {
|
392
397
|
public:
|
393
398
|
explicit StateWatcher(RefCountedPtr<ChannelState> parent)
|
394
|
-
: AsyncConnectivityStateWatcherInterface(
|
399
|
+
: AsyncConnectivityStateWatcherInterface(
|
400
|
+
parent->xds_client()->work_serializer_),
|
395
401
|
parent_(std::move(parent)) {}
|
396
402
|
|
397
403
|
private:
|
@@ -444,7 +450,7 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
|
|
444
450
|
GRPC_ARG_KEEPALIVE_TIME_MS,
|
445
451
|
};
|
446
452
|
// Channel args to add.
|
447
|
-
InlinedVector<grpc_arg, 3> args_to_add;
|
453
|
+
absl::InlinedVector<grpc_arg, 3> args_to_add;
|
448
454
|
// Keepalive interval.
|
449
455
|
args_to_add.emplace_back(grpc_channel_arg_integer_create(
|
450
456
|
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));
|
@@ -580,6 +586,9 @@ XdsClient::ChannelState::RetryableCall
|
|
580
586
|
.set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER)
|
581
587
|
.set_jitter(GRPC_XDS_RECONNECT_JITTER)
|
582
588
|
.set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
|
589
|
+
// Closure Initialization
|
590
|
+
GRPC_CLOSURE_INIT(&on_retry_timer_, OnRetryTimer, this,
|
591
|
+
grpc_schedule_on_exec_ctx);
|
583
592
|
StartNewCallLocked();
|
584
593
|
}
|
585
594
|
|
@@ -633,8 +642,6 @@ void XdsClient::ChannelState::RetryableCall
|
|
633
642
|
chand()->xds_client(), chand(), timeout);
|
634
643
|
}
|
635
644
|
this->Ref(DEBUG_LOCATION, "RetryableCall+retry_timer_start").release();
|
636
|
-
GRPC_CLOSURE_INIT(&on_retry_timer_, OnRetryTimer, this,
|
637
|
-
grpc_schedule_on_exec_ctx);
|
638
645
|
grpc_timer_init(&retry_timer_, next_attempt_time, &on_retry_timer_);
|
639
646
|
retry_timer_callback_pending_ = true;
|
640
647
|
}
|
@@ -643,27 +650,26 @@ template
|
|
643
650
|
void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimer(
|
644
651
|
void* arg, grpc_error* error) {
|
645
652
|
RetryableCall* calld = static_cast<RetryableCall*>(arg);
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
GRPC_ERROR_REF(error));
|
653
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
654
|
+
calld->chand_->xds_client()->work_serializer_->Run(
|
655
|
+
[calld, error]() { calld->OnRetryTimerLocked(error); }, DEBUG_LOCATION);
|
650
656
|
}
|
651
657
|
|
652
658
|
template <typename T>
|
653
659
|
void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
if (!calld->shutting_down_ && error == GRPC_ERROR_NONE) {
|
660
|
+
grpc_error* error) {
|
661
|
+
retry_timer_callback_pending_ = false;
|
662
|
+
if (!shutting_down_ && error == GRPC_ERROR_NONE) {
|
658
663
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
659
664
|
gpr_log(
|
660
665
|
GPR_INFO,
|
661
666
|
"[xds_client %p] Retry timer fires (chand: %p, retryable call: %p)",
|
662
|
-
|
667
|
+
chand()->xds_client(), chand(), this);
|
663
668
|
}
|
664
|
-
|
669
|
+
StartNewCallLocked();
|
665
670
|
}
|
666
|
-
|
671
|
+
this->Unref(DEBUG_LOCATION, "RetryableCall+retry_timer_done");
|
672
|
+
GRPC_ERROR_UNREF(error);
|
667
673
|
}
|
668
674
|
|
669
675
|
//
|
@@ -798,33 +804,13 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
|
|
798
804
|
}
|
799
805
|
auto& state = state_map_[type_url];
|
800
806
|
grpc_slice request_payload_slice;
|
801
|
-
std::set<
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
} else if (type_url == XdsApi::kRdsTypeUrl) {
|
809
|
-
resource_names.insert(xds_client()->lds_result_->route_config_name);
|
810
|
-
request_payload_slice = xds_client()->api_.CreateRdsRequest(
|
811
|
-
xds_client()->lds_result_->route_config_name, state.version,
|
812
|
-
state.nonce, GRPC_ERROR_REF(state.error), !sent_initial_message_);
|
813
|
-
state.subscribed_resources[xds_client()->lds_result_->route_config_name]
|
814
|
-
->Start(Ref());
|
815
|
-
} else if (type_url == XdsApi::kCdsTypeUrl) {
|
816
|
-
resource_names = ClusterNamesForRequest();
|
817
|
-
request_payload_slice = xds_client()->api_.CreateCdsRequest(
|
818
|
-
resource_names, state.version, state.nonce, GRPC_ERROR_REF(state.error),
|
819
|
-
!sent_initial_message_);
|
820
|
-
} else if (type_url == XdsApi::kEdsTypeUrl) {
|
821
|
-
resource_names = EdsServiceNamesForRequest();
|
822
|
-
request_payload_slice = xds_client()->api_.CreateEdsRequest(
|
823
|
-
resource_names, state.version, state.nonce, GRPC_ERROR_REF(state.error),
|
824
|
-
!sent_initial_message_);
|
825
|
-
} else {
|
826
|
-
request_payload_slice = xds_client()->api_.CreateUnsupportedTypeNackRequest(
|
827
|
-
type_url, state.nonce, GRPC_ERROR_REF(state.error));
|
807
|
+
std::set<absl::string_view> resource_names =
|
808
|
+
ResourceNamesForRequest(type_url);
|
809
|
+
request_payload_slice = xds_client()->api_.CreateAdsRequest(
|
810
|
+
type_url, resource_names, state.version, state.nonce,
|
811
|
+
GRPC_ERROR_REF(state.error), !sent_initial_message_);
|
812
|
+
if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
|
813
|
+
type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
|
828
814
|
state_map_.erase(type_url);
|
829
815
|
}
|
830
816
|
sent_initial_message_ = true;
|
@@ -889,22 +875,35 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
889
875
|
gpr_log(GPR_INFO,
|
890
876
|
"[xds_client %p] LDS update does not include requested resource",
|
891
877
|
xds_client());
|
892
|
-
xds_client()->
|
893
|
-
|
894
|
-
|
878
|
+
if (xds_client()->lds_result_.has_value() &&
|
879
|
+
!xds_client()->lds_result_->route_config_name.empty()) {
|
880
|
+
Unsubscribe(XdsApi::kRdsTypeUrl,
|
881
|
+
xds_client()->lds_result_->route_config_name,
|
882
|
+
/*delay_unsubscription=*/false);
|
883
|
+
xds_client()->rds_result_.reset();
|
884
|
+
}
|
885
|
+
xds_client()->lds_result_.reset();
|
886
|
+
xds_client()->service_config_watcher_->OnResourceDoesNotExist();
|
895
887
|
return;
|
896
888
|
}
|
897
889
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
898
890
|
gpr_log(GPR_INFO,
|
899
|
-
"[xds_client %p] LDS update received: route_config_name=%s,
|
900
|
-
"cluster_name=%s",
|
891
|
+
"[xds_client %p] LDS update received: route_config_name=%s",
|
901
892
|
xds_client(),
|
902
893
|
(!lds_update->route_config_name.empty()
|
903
894
|
? lds_update->route_config_name.c_str()
|
904
|
-
: "<inlined>")
|
905
|
-
|
906
|
-
|
907
|
-
|
895
|
+
: "<inlined>"));
|
896
|
+
if (lds_update->rds_update.has_value()) {
|
897
|
+
gpr_log(GPR_INFO, " RouteConfiguration contains %" PRIuPTR " routes",
|
898
|
+
lds_update->rds_update.value().routes.size());
|
899
|
+
for (const auto& route : lds_update->rds_update.value().routes) {
|
900
|
+
gpr_log(GPR_INFO,
|
901
|
+
" route: { service=\"%s\", "
|
902
|
+
"method=\"%s\" }, cluster=\"%s\" }",
|
903
|
+
route.service.c_str(), route.method.c_str(),
|
904
|
+
route.cluster_name.c_str());
|
905
|
+
}
|
906
|
+
}
|
908
907
|
}
|
909
908
|
auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
|
910
909
|
auto& state = lds_state.subscribed_resources[xds_client()->server_name_];
|
@@ -923,6 +922,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
923
922
|
Unsubscribe(
|
924
923
|
XdsApi::kRdsTypeUrl, xds_client()->lds_result_->route_config_name,
|
925
924
|
/*delay_unsubscription=*/!lds_update->route_config_name.empty());
|
925
|
+
xds_client()->rds_result_.reset();
|
926
926
|
}
|
927
927
|
xds_client()->lds_result_ = std::move(lds_update);
|
928
928
|
if (xds_client()->lds_result_->rds_update.has_value()) {
|
@@ -930,7 +930,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
930
930
|
// the watcher immediately.
|
931
931
|
RefCountedPtr<ServiceConfig> service_config;
|
932
932
|
grpc_error* error = xds_client()->CreateServiceConfig(
|
933
|
-
xds_client()->lds_result_->rds_update
|
933
|
+
xds_client()->lds_result_->rds_update.value(), &service_config);
|
934
934
|
if (error == GRPC_ERROR_NONE) {
|
935
935
|
xds_client()->service_config_watcher_->OnServiceConfigChanged(
|
936
936
|
std::move(service_config));
|
@@ -950,14 +950,22 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
|
950
950
|
gpr_log(GPR_INFO,
|
951
951
|
"[xds_client %p] RDS update does not include requested resource",
|
952
952
|
xds_client());
|
953
|
-
xds_client()->
|
954
|
-
|
955
|
-
"RDS update does not include requested resource"));
|
953
|
+
xds_client()->rds_result_.reset();
|
954
|
+
xds_client()->service_config_watcher_->OnResourceDoesNotExist();
|
956
955
|
return;
|
957
956
|
}
|
958
957
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
959
|
-
gpr_log(GPR_INFO,
|
960
|
-
xds_client
|
958
|
+
gpr_log(GPR_INFO,
|
959
|
+
"[xds_client %p] RDS update received; RouteConfiguration contains "
|
960
|
+
"%" PRIuPTR " routes",
|
961
|
+
this, rds_update.value().routes.size());
|
962
|
+
for (const auto& route : rds_update.value().routes) {
|
963
|
+
gpr_log(GPR_INFO,
|
964
|
+
" route: { service=\"%s\", "
|
965
|
+
"method=\"%s\" }, cluster=\"%s\" }",
|
966
|
+
route.service.c_str(), route.method.c_str(),
|
967
|
+
route.cluster_name.c_str());
|
968
|
+
}
|
961
969
|
}
|
962
970
|
auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
|
963
971
|
auto& state =
|
@@ -977,7 +985,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
|
977
985
|
// Notify the watcher.
|
978
986
|
RefCountedPtr<ServiceConfig> service_config;
|
979
987
|
grpc_error* error = xds_client()->CreateServiceConfig(
|
980
|
-
xds_client()->rds_result_
|
988
|
+
xds_client()->rds_result_.value(), &service_config);
|
981
989
|
if (error == GRPC_ERROR_NONE) {
|
982
990
|
xds_client()->service_config_watcher_->OnServiceConfigChanged(
|
983
991
|
std::move(service_config));
|
@@ -1029,20 +1037,20 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
|
1029
1037
|
}
|
1030
1038
|
}
|
1031
1039
|
// For any subscribed resource that is not present in the update,
|
1032
|
-
// remove it from the cache and notify watchers
|
1040
|
+
// remove it from the cache and notify watchers that it does not exist.
|
1033
1041
|
for (const auto& p : cds_state.subscribed_resources) {
|
1034
1042
|
const std::string& cluster_name = p.first;
|
1035
1043
|
if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
|
1036
1044
|
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
|
1037
1045
|
cluster_state.update.reset();
|
1038
1046
|
for (const auto& p : cluster_state.watchers) {
|
1039
|
-
p.first->
|
1040
|
-
"Cluster not present in CDS update"));
|
1047
|
+
p.first->OnResourceDoesNotExist();
|
1041
1048
|
}
|
1042
1049
|
}
|
1043
1050
|
}
|
1044
|
-
//
|
1045
|
-
// resources
|
1051
|
+
// For any EDS resource that is no longer referred to by any CDS
|
1052
|
+
// resources, remove it from the cache and notify watchers that it
|
1053
|
+
// does not exist.
|
1046
1054
|
auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
|
1047
1055
|
for (const auto& p : eds_state.subscribed_resources) {
|
1048
1056
|
const std::string& eds_resource_name = p.first;
|
@@ -1052,8 +1060,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
|
1052
1060
|
xds_client()->endpoint_map_[eds_resource_name];
|
1053
1061
|
endpoint_state.update.reset();
|
1054
1062
|
for (const auto& p : endpoint_state.watchers) {
|
1055
|
-
p.first->
|
1056
|
-
"ClusterLoadAssignment resource removed due to CDS update"));
|
1063
|
+
p.first->OnResourceDoesNotExist();
|
1057
1064
|
}
|
1058
1065
|
}
|
1059
1066
|
}
|
@@ -1093,15 +1100,13 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
1093
1100
|
locality.name->AsHumanReadableString(), locality.lb_weight,
|
1094
1101
|
locality.serverlist.size());
|
1095
1102
|
for (size_t i = 0; i < locality.serverlist.size(); ++i) {
|
1096
|
-
|
1097
|
-
|
1098
|
-
false);
|
1103
|
+
std::string ipport = grpc_sockaddr_to_string(
|
1104
|
+
&locality.serverlist[i].address(), false);
|
1099
1105
|
gpr_log(GPR_INFO,
|
1100
1106
|
"[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
|
1101
1107
|
" %s, server address %" PRIuPTR ": %s",
|
1102
1108
|
xds_client(), priority, locality_count,
|
1103
|
-
locality.name->AsHumanReadableString(), i, ipport);
|
1104
|
-
gpr_free(ipport);
|
1109
|
+
locality.name->AsHumanReadableString(), i, ipport.c_str());
|
1105
1110
|
}
|
1106
1111
|
++locality_count;
|
1107
1112
|
}
|
@@ -1147,19 +1152,18 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
1147
1152
|
void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
|
1148
1153
|
grpc_error* error) {
|
1149
1154
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1155
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1156
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1157
|
+
[ads_calld, error]() { ads_calld->OnRequestSentLocked(error); },
|
1158
|
+
DEBUG_LOCATION);
|
1154
1159
|
}
|
1155
1160
|
|
1156
1161
|
void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
|
1157
|
-
|
1158
|
-
|
1159
|
-
if (self->IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
|
1162
|
+
grpc_error* error) {
|
1163
|
+
if (IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
|
1160
1164
|
// Clean up the sent message.
|
1161
|
-
grpc_byte_buffer_destroy(
|
1162
|
-
|
1165
|
+
grpc_byte_buffer_destroy(send_message_payload_);
|
1166
|
+
send_message_payload_ = nullptr;
|
1163
1167
|
// Continue to send another pending message if any.
|
1164
1168
|
// TODO(roth): The current code to handle buffered messages has the
|
1165
1169
|
// advantage of sending only the most recent list of resource names for
|
@@ -1169,41 +1173,36 @@ void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
|
|
1169
1173
|
// order of resource types. We need to fix this if we are seeing some
|
1170
1174
|
// resource type(s) starved due to frequent requests of other resource
|
1171
1175
|
// type(s).
|
1172
|
-
auto it =
|
1173
|
-
if (it !=
|
1174
|
-
|
1175
|
-
|
1176
|
+
auto it = buffered_requests_.begin();
|
1177
|
+
if (it != buffered_requests_.end()) {
|
1178
|
+
SendMessageLocked(*it);
|
1179
|
+
buffered_requests_.erase(it);
|
1176
1180
|
}
|
1177
1181
|
}
|
1178
|
-
|
1182
|
+
Unref(DEBUG_LOCATION, "ADS+OnRequestSentLocked");
|
1183
|
+
GRPC_ERROR_UNREF(error);
|
1179
1184
|
}
|
1180
1185
|
|
1181
1186
|
void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
|
1182
|
-
void* arg, grpc_error* error) {
|
1187
|
+
void* arg, grpc_error* /* error */) {
|
1183
1188
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1184
|
-
ads_calld->xds_client()->
|
1185
|
-
|
1186
|
-
OnResponseReceivedLocked, ads_calld, nullptr),
|
1187
|
-
GRPC_ERROR_REF(error));
|
1189
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1190
|
+
[ads_calld]() { ads_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
|
1188
1191
|
}
|
1189
1192
|
|
1190
|
-
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
1191
|
-
void* arg, grpc_error* /*error*/) {
|
1192
|
-
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1193
|
-
XdsClient* xds_client = ads_calld->xds_client();
|
1193
|
+
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
|
1194
1194
|
// Empty payload means the call was cancelled.
|
1195
|
-
if (!
|
1196
|
-
|
1197
|
-
ads_calld->Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
|
1195
|
+
if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
|
1196
|
+
Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
|
1198
1197
|
return;
|
1199
1198
|
}
|
1200
1199
|
// Read the response.
|
1201
1200
|
grpc_byte_buffer_reader bbr;
|
1202
|
-
grpc_byte_buffer_reader_init(&bbr,
|
1201
|
+
grpc_byte_buffer_reader_init(&bbr, recv_message_payload_);
|
1203
1202
|
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
1204
1203
|
grpc_byte_buffer_reader_destroy(&bbr);
|
1205
|
-
grpc_byte_buffer_destroy(
|
1206
|
-
|
1204
|
+
grpc_byte_buffer_destroy(recv_message_payload_);
|
1205
|
+
recv_message_payload_ = nullptr;
|
1207
1206
|
// TODO(juanlishen): When we convert this to use the xds protocol, the
|
1208
1207
|
// balancer will send us a fallback timeout such that we should go into
|
1209
1208
|
// fallback mode if we have lost contact with the balancer after a certain
|
@@ -1221,24 +1220,22 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
|
1221
1220
|
std::string nonce;
|
1222
1221
|
std::string type_url;
|
1223
1222
|
// Note that ParseAdsResponse() also validates the response.
|
1224
|
-
grpc_error* parse_error = xds_client->api_.ParseAdsResponse(
|
1225
|
-
response_slice, xds_client->server_name_,
|
1226
|
-
(
|
1227
|
-
|
1228
|
-
|
1229
|
-
ads_calld->ClusterNamesForRequest(),
|
1230
|
-
ads_calld->EdsServiceNamesForRequest(), &lds_update, &rds_update,
|
1223
|
+
grpc_error* parse_error = xds_client()->api_.ParseAdsResponse(
|
1224
|
+
response_slice, xds_client()->server_name_,
|
1225
|
+
ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
|
1226
|
+
ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
|
1227
|
+
ResourceNamesForRequest(XdsApi::kEdsTypeUrl), &lds_update, &rds_update,
|
1231
1228
|
&cds_update_map, &eds_update_map, &version, &nonce, &type_url);
|
1232
1229
|
grpc_slice_unref_internal(response_slice);
|
1233
1230
|
if (type_url.empty()) {
|
1234
1231
|
// Ignore unparsable response.
|
1235
1232
|
gpr_log(GPR_ERROR,
|
1236
1233
|
"[xds_client %p] Error parsing ADS response (%s) -- ignoring",
|
1237
|
-
xds_client, grpc_error_string(parse_error));
|
1234
|
+
xds_client(), grpc_error_string(parse_error));
|
1238
1235
|
GRPC_ERROR_UNREF(parse_error);
|
1239
1236
|
} else {
|
1240
1237
|
// Update nonce.
|
1241
|
-
auto& state =
|
1238
|
+
auto& state = state_map_[type_url];
|
1242
1239
|
state.nonce = std::move(nonce);
|
1243
1240
|
// NACK or ACK the response.
|
1244
1241
|
if (parse_error != GRPC_ERROR_NONE) {
|
@@ -1248,85 +1245,80 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
|
1248
1245
|
gpr_log(GPR_ERROR,
|
1249
1246
|
"[xds_client %p] ADS response invalid for resource type %s "
|
1250
1247
|
"version %s, will NACK: nonce=%s error=%s",
|
1251
|
-
xds_client, type_url.c_str(), version.c_str(),
|
1248
|
+
xds_client(), type_url.c_str(), version.c_str(),
|
1252
1249
|
state.nonce.c_str(), grpc_error_string(parse_error));
|
1253
|
-
|
1250
|
+
SendMessageLocked(type_url);
|
1254
1251
|
} else {
|
1255
|
-
|
1252
|
+
seen_response_ = true;
|
1256
1253
|
// Accept the ADS response according to the type_url.
|
1257
1254
|
if (type_url == XdsApi::kLdsTypeUrl) {
|
1258
|
-
|
1255
|
+
AcceptLdsUpdate(std::move(lds_update));
|
1259
1256
|
} else if (type_url == XdsApi::kRdsTypeUrl) {
|
1260
|
-
|
1257
|
+
AcceptRdsUpdate(std::move(rds_update));
|
1261
1258
|
} else if (type_url == XdsApi::kCdsTypeUrl) {
|
1262
|
-
|
1259
|
+
AcceptCdsUpdate(std::move(cds_update_map));
|
1263
1260
|
} else if (type_url == XdsApi::kEdsTypeUrl) {
|
1264
|
-
|
1261
|
+
AcceptEdsUpdate(std::move(eds_update_map));
|
1265
1262
|
}
|
1266
1263
|
state.version = std::move(version);
|
1267
1264
|
// ACK the update.
|
1268
|
-
|
1265
|
+
SendMessageLocked(type_url);
|
1269
1266
|
// Start load reporting if needed.
|
1270
|
-
auto& lrs_call =
|
1267
|
+
auto& lrs_call = chand()->lrs_calld_;
|
1271
1268
|
if (lrs_call != nullptr) {
|
1272
1269
|
LrsCallState* lrs_calld = lrs_call->calld();
|
1273
1270
|
if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
|
1274
1271
|
}
|
1275
1272
|
}
|
1276
1273
|
}
|
1277
|
-
if (xds_client->shutting_down_) {
|
1278
|
-
|
1279
|
-
"ADS+OnResponseReceivedLocked+xds_shutdown");
|
1274
|
+
if (xds_client()->shutting_down_) {
|
1275
|
+
Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked+xds_shutdown");
|
1280
1276
|
return;
|
1281
1277
|
}
|
1282
1278
|
// Keep listening for updates.
|
1283
1279
|
grpc_op op;
|
1284
1280
|
memset(&op, 0, sizeof(op));
|
1285
1281
|
op.op = GRPC_OP_RECV_MESSAGE;
|
1286
|
-
op.data.recv_message.recv_message = &
|
1282
|
+
op.data.recv_message.recv_message = &recv_message_payload_;
|
1287
1283
|
op.flags = 0;
|
1288
1284
|
op.reserved = nullptr;
|
1289
|
-
GPR_ASSERT(
|
1285
|
+
GPR_ASSERT(call_ != nullptr);
|
1290
1286
|
// Reuse the "ADS+OnResponseReceivedLocked" ref taken in ctor.
|
1291
|
-
|
1292
|
-
|
1293
|
-
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1294
|
-
ads_calld->call_, &op, 1, &ads_calld->on_response_received_);
|
1287
|
+
const grpc_call_error call_error =
|
1288
|
+
grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
|
1295
1289
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1296
1290
|
}
|
1297
1291
|
|
1298
1292
|
void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
|
1299
1293
|
void* arg, grpc_error* error) {
|
1300
1294
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1295
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1296
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1297
|
+
[ads_calld, error]() { ads_calld->OnStatusReceivedLocked(error); },
|
1298
|
+
DEBUG_LOCATION);
|
1305
1299
|
}
|
1306
1300
|
|
1307
1301
|
void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
|
1308
|
-
|
1309
|
-
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1310
|
-
ChannelState* chand = ads_calld->chand();
|
1311
|
-
XdsClient* xds_client = ads_calld->xds_client();
|
1302
|
+
grpc_error* error) {
|
1312
1303
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1313
|
-
char* status_details = grpc_slice_to_c_string(
|
1304
|
+
char* status_details = grpc_slice_to_c_string(status_details_);
|
1314
1305
|
gpr_log(GPR_INFO,
|
1315
1306
|
"[xds_client %p] ADS call status received. Status = %d, details "
|
1316
1307
|
"= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
|
1317
|
-
xds_client,
|
1318
|
-
|
1308
|
+
xds_client(), status_code_, status_details, chand(), this, call_,
|
1309
|
+
grpc_error_string(error));
|
1319
1310
|
gpr_free(status_details);
|
1320
1311
|
}
|
1321
1312
|
// Ignore status from a stale call.
|
1322
|
-
if (
|
1313
|
+
if (IsCurrentCallOnChannel()) {
|
1323
1314
|
// Try to restart the call.
|
1324
|
-
|
1315
|
+
parent_->OnCallFinishedLocked();
|
1325
1316
|
// Send error to all watchers.
|
1326
|
-
xds_client->NotifyOnError(
|
1317
|
+
xds_client()->NotifyOnError(
|
1327
1318
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("xds call failed"));
|
1328
1319
|
}
|
1329
|
-
|
1320
|
+
Unref(DEBUG_LOCATION, "ADS+OnStatusReceivedLocked");
|
1321
|
+
GRPC_ERROR_UNREF(error);
|
1330
1322
|
}
|
1331
1323
|
|
1332
1324
|
bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
|
@@ -1336,26 +1328,19 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
|
|
1336
1328
|
return this == chand()->ads_calld_->calld();
|
1337
1329
|
}
|
1338
1330
|
|
1339
|
-
std::set<
|
1340
|
-
XdsClient::ChannelState::AdsCallState::
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
std::set<StringView>
|
1351
|
-
XdsClient::ChannelState::AdsCallState::EdsServiceNamesForRequest() {
|
1352
|
-
std::set<StringView> eds_names;
|
1353
|
-
for (auto& p : state_map_[XdsApi::kEdsTypeUrl].subscribed_resources) {
|
1354
|
-
eds_names.insert(p.first);
|
1355
|
-
OrphanablePtr<ResourceState>& state = p.second;
|
1356
|
-
state->Start(Ref());
|
1331
|
+
std::set<absl::string_view>
|
1332
|
+
XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
|
1333
|
+
const std::string& type_url) {
|
1334
|
+
std::set<absl::string_view> resource_names;
|
1335
|
+
auto it = state_map_.find(type_url);
|
1336
|
+
if (it != state_map_.end()) {
|
1337
|
+
for (auto& p : it->second.subscribed_resources) {
|
1338
|
+
resource_names.insert(p.first);
|
1339
|
+
OrphanablePtr<ResourceState>& state = p.second;
|
1340
|
+
state->Start(Ref());
|
1341
|
+
}
|
1357
1342
|
}
|
1358
|
-
return
|
1343
|
+
return resource_names;
|
1359
1344
|
}
|
1360
1345
|
|
1361
1346
|
//
|
@@ -1371,8 +1356,6 @@ void XdsClient::ChannelState::LrsCallState::Reporter::Orphan() {
|
|
1371
1356
|
void XdsClient::ChannelState::LrsCallState::Reporter::
|
1372
1357
|
ScheduleNextReportLocked() {
|
1373
1358
|
const grpc_millis next_report_time = ExecCtx::Get()->Now() + report_interval_;
|
1374
|
-
GRPC_CLOSURE_INIT(&on_next_report_timer_, OnNextReportTimer, this,
|
1375
|
-
grpc_schedule_on_exec_ctx);
|
1376
1359
|
grpc_timer_init(&next_report_timer_, next_report_time,
|
1377
1360
|
&on_next_report_timer_);
|
1378
1361
|
next_report_timer_callback_pending_ = true;
|
@@ -1381,21 +1364,21 @@ void XdsClient::ChannelState::LrsCallState::Reporter::
|
|
1381
1364
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimer(
|
1382
1365
|
void* arg, grpc_error* error) {
|
1383
1366
|
Reporter* self = static_cast<Reporter*>(arg);
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1367
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1368
|
+
self->xds_client()->work_serializer_->Run(
|
1369
|
+
[self, error]() { self->OnNextReportTimerLocked(error); },
|
1370
|
+
DEBUG_LOCATION);
|
1388
1371
|
}
|
1389
1372
|
|
1390
1373
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1374
|
+
grpc_error* error) {
|
1375
|
+
next_report_timer_callback_pending_ = false;
|
1376
|
+
if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
|
1377
|
+
Unref(DEBUG_LOCATION, "Reporter+timer");
|
1378
|
+
} else {
|
1379
|
+
SendReportLocked();
|
1397
1380
|
}
|
1398
|
-
|
1381
|
+
GRPC_ERROR_UNREF(error);
|
1399
1382
|
}
|
1400
1383
|
|
1401
1384
|
namespace {
|
@@ -1418,8 +1401,8 @@ bool LoadReportCountersAreZero(const XdsApi::ClusterLoadReportMap& snapshot) {
|
|
1418
1401
|
|
1419
1402
|
void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
1420
1403
|
// Construct snapshot from all reported stats.
|
1421
|
-
XdsApi::ClusterLoadReportMap snapshot =
|
1422
|
-
|
1404
|
+
XdsApi::ClusterLoadReportMap snapshot = xds_client()->BuildLoadReportSnapshot(
|
1405
|
+
parent_->send_all_clusters_, parent_->cluster_names_);
|
1423
1406
|
// Skip client load report if the counters were all zero in the last
|
1424
1407
|
// report and they are still zero in this one.
|
1425
1408
|
const bool old_val = last_report_counters_were_zero_;
|
@@ -1439,8 +1422,6 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
|
1439
1422
|
memset(&op, 0, sizeof(op));
|
1440
1423
|
op.op = GRPC_OP_SEND_MESSAGE;
|
1441
1424
|
op.data.send_message.send_message = parent_->send_message_payload_;
|
1442
|
-
GRPC_CLOSURE_INIT(&on_report_done_, OnReportDone, this,
|
1443
|
-
grpc_schedule_on_exec_ctx);
|
1444
1425
|
grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1445
1426
|
parent_->call_, &op, 1, &on_report_done_);
|
1446
1427
|
if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) {
|
@@ -1454,33 +1435,32 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
|
1454
1435
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDone(
|
1455
1436
|
void* arg, grpc_error* error) {
|
1456
1437
|
Reporter* self = static_cast<Reporter*>(arg);
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
GRPC_ERROR_REF(error));
|
1438
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1439
|
+
self->xds_client()->work_serializer_->Run(
|
1440
|
+
[self, error]() { self->OnReportDoneLocked(error); }, DEBUG_LOCATION);
|
1461
1441
|
}
|
1462
1442
|
|
1463
1443
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
self->parent_->send_message_payload_ = nullptr;
|
1444
|
+
grpc_error* error) {
|
1445
|
+
grpc_byte_buffer_destroy(parent_->send_message_payload_);
|
1446
|
+
parent_->send_message_payload_ = nullptr;
|
1468
1447
|
// If there are no more registered stats to report, cancel the call.
|
1469
|
-
if (
|
1470
|
-
|
1471
|
-
|
1448
|
+
if (xds_client()->load_report_map_.empty()) {
|
1449
|
+
parent_->chand()->StopLrsCall();
|
1450
|
+
Unref(DEBUG_LOCATION, "Reporter+report_done+no_more_reporters");
|
1472
1451
|
return;
|
1473
1452
|
}
|
1474
|
-
if (error != GRPC_ERROR_NONE || !
|
1453
|
+
if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
|
1475
1454
|
// If this reporter is no longer the current one on the call, the reason
|
1476
1455
|
// might be that it was orphaned for a new one due to config update.
|
1477
|
-
if (!
|
1478
|
-
|
1456
|
+
if (!IsCurrentReporterOnCall()) {
|
1457
|
+
parent_->MaybeStartReportingLocked();
|
1479
1458
|
}
|
1480
|
-
|
1481
|
-
|
1459
|
+
Unref(DEBUG_LOCATION, "Reporter+report_done");
|
1460
|
+
} else {
|
1461
|
+
ScheduleNextReportLocked();
|
1482
1462
|
}
|
1483
|
-
|
1463
|
+
GRPC_ERROR_UNREF(error);
|
1484
1464
|
}
|
1485
1465
|
|
1486
1466
|
//
|
@@ -1626,75 +1606,70 @@ void XdsClient::ChannelState::LrsCallState::MaybeStartReportingLocked() {
|
|
1626
1606
|
}
|
1627
1607
|
|
1628
1608
|
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSent(
|
1629
|
-
void* arg, grpc_error* error) {
|
1609
|
+
void* arg, grpc_error* /*error*/) {
|
1630
1610
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1631
|
-
lrs_calld->xds_client()->
|
1632
|
-
|
1633
|
-
|
1634
|
-
GRPC_ERROR_REF(error));
|
1611
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1612
|
+
[lrs_calld]() { lrs_calld->OnInitialRequestSentLocked(); },
|
1613
|
+
DEBUG_LOCATION);
|
1635
1614
|
}
|
1636
1615
|
|
1637
|
-
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked(
|
1638
|
-
void* arg, grpc_error* /*error*/) {
|
1639
|
-
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1616
|
+
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked() {
|
1640
1617
|
// Clear the send_message_payload_.
|
1641
|
-
grpc_byte_buffer_destroy(
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1618
|
+
grpc_byte_buffer_destroy(send_message_payload_);
|
1619
|
+
send_message_payload_ = nullptr;
|
1620
|
+
MaybeStartReportingLocked();
|
1621
|
+
Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked");
|
1645
1622
|
}
|
1646
1623
|
|
1647
1624
|
void XdsClient::ChannelState::LrsCallState::OnResponseReceived(
|
1648
|
-
void* arg, grpc_error* error) {
|
1625
|
+
void* arg, grpc_error* /*error*/) {
|
1649
1626
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1650
|
-
lrs_calld->xds_client()->
|
1651
|
-
|
1652
|
-
OnResponseReceivedLocked, lrs_calld, nullptr),
|
1653
|
-
GRPC_ERROR_REF(error));
|
1627
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1628
|
+
[lrs_calld]() { lrs_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
|
1654
1629
|
}
|
1655
1630
|
|
1656
|
-
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
1657
|
-
void* arg, grpc_error* /*error*/) {
|
1658
|
-
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1659
|
-
XdsClient* xds_client = lrs_calld->xds_client();
|
1631
|
+
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
|
1660
1632
|
// Empty payload means the call was cancelled.
|
1661
|
-
if (!
|
1662
|
-
|
1663
|
-
lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
|
1633
|
+
if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
|
1634
|
+
Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
|
1664
1635
|
return;
|
1665
1636
|
}
|
1666
1637
|
// Read the response.
|
1667
1638
|
grpc_byte_buffer_reader bbr;
|
1668
|
-
grpc_byte_buffer_reader_init(&bbr,
|
1639
|
+
grpc_byte_buffer_reader_init(&bbr, recv_message_payload_);
|
1669
1640
|
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
1670
1641
|
grpc_byte_buffer_reader_destroy(&bbr);
|
1671
|
-
grpc_byte_buffer_destroy(
|
1672
|
-
|
1642
|
+
grpc_byte_buffer_destroy(recv_message_payload_);
|
1643
|
+
recv_message_payload_ = nullptr;
|
1673
1644
|
// This anonymous lambda is a hack to avoid the usage of goto.
|
1674
1645
|
[&]() {
|
1675
1646
|
// Parse the response.
|
1647
|
+
bool send_all_clusters = false;
|
1676
1648
|
std::set<std::string> new_cluster_names;
|
1677
1649
|
grpc_millis new_load_reporting_interval;
|
1678
|
-
grpc_error* parse_error = xds_client->api_.ParseLrsResponse(
|
1679
|
-
response_slice, &
|
1650
|
+
grpc_error* parse_error = xds_client()->api_.ParseLrsResponse(
|
1651
|
+
response_slice, &send_all_clusters, &new_cluster_names,
|
1652
|
+
&new_load_reporting_interval);
|
1680
1653
|
if (parse_error != GRPC_ERROR_NONE) {
|
1681
1654
|
gpr_log(GPR_ERROR,
|
1682
1655
|
"[xds_client %p] LRS response parsing failed. error=%s",
|
1683
|
-
xds_client, grpc_error_string(parse_error));
|
1656
|
+
xds_client(), grpc_error_string(parse_error));
|
1684
1657
|
GRPC_ERROR_UNREF(parse_error);
|
1685
1658
|
return;
|
1686
1659
|
}
|
1687
|
-
|
1660
|
+
seen_response_ = true;
|
1688
1661
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1689
|
-
gpr_log(
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1662
|
+
gpr_log(
|
1663
|
+
GPR_INFO,
|
1664
|
+
"[xds_client %p] LRS response received, %" PRIuPTR
|
1665
|
+
" cluster names, send_all_clusters=%d, load_report_interval=%" PRId64
|
1666
|
+
"ms",
|
1667
|
+
xds_client(), new_cluster_names.size(), send_all_clusters,
|
1668
|
+
new_load_reporting_interval);
|
1694
1669
|
size_t i = 0;
|
1695
1670
|
for (const auto& name : new_cluster_names) {
|
1696
1671
|
gpr_log(GPR_INFO, "[xds_client %p] cluster_name %" PRIuPTR ": %s",
|
1697
|
-
xds_client, i++, name.c_str());
|
1672
|
+
xds_client(), i++, name.c_str());
|
1698
1673
|
}
|
1699
1674
|
}
|
1700
1675
|
if (new_load_reporting_interval <
|
@@ -1705,81 +1680,78 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
|
1705
1680
|
gpr_log(GPR_INFO,
|
1706
1681
|
"[xds_client %p] Increased load_report_interval to minimum "
|
1707
1682
|
"value %dms",
|
1708
|
-
xds_client, GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
|
1683
|
+
xds_client(), GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
|
1709
1684
|
}
|
1710
1685
|
}
|
1711
1686
|
// Ignore identical update.
|
1712
|
-
if (
|
1713
|
-
|
1687
|
+
if (send_all_clusters == send_all_clusters_ &&
|
1688
|
+
cluster_names_ == new_cluster_names &&
|
1689
|
+
load_reporting_interval_ == new_load_reporting_interval) {
|
1714
1690
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1715
1691
|
gpr_log(GPR_INFO,
|
1716
1692
|
"[xds_client %p] Incoming LRS response identical to current, "
|
1717
1693
|
"ignoring.",
|
1718
|
-
xds_client);
|
1694
|
+
xds_client());
|
1719
1695
|
}
|
1720
1696
|
return;
|
1721
1697
|
}
|
1722
1698
|
// Stop current load reporting (if any) to adopt the new config.
|
1723
|
-
|
1699
|
+
reporter_.reset();
|
1724
1700
|
// Record the new config.
|
1725
|
-
|
1726
|
-
|
1701
|
+
send_all_clusters_ = send_all_clusters;
|
1702
|
+
cluster_names_ = std::move(new_cluster_names);
|
1703
|
+
load_reporting_interval_ = new_load_reporting_interval;
|
1727
1704
|
// Try starting sending load report.
|
1728
|
-
|
1705
|
+
MaybeStartReportingLocked();
|
1729
1706
|
}();
|
1730
1707
|
grpc_slice_unref_internal(response_slice);
|
1731
|
-
if (xds_client->shutting_down_) {
|
1732
|
-
|
1733
|
-
"LRS+OnResponseReceivedLocked+xds_shutdown");
|
1708
|
+
if (xds_client()->shutting_down_) {
|
1709
|
+
Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked+xds_shutdown");
|
1734
1710
|
return;
|
1735
1711
|
}
|
1736
1712
|
// Keep listening for LRS config updates.
|
1737
1713
|
grpc_op op;
|
1738
1714
|
memset(&op, 0, sizeof(op));
|
1739
1715
|
op.op = GRPC_OP_RECV_MESSAGE;
|
1740
|
-
op.data.recv_message.recv_message = &
|
1716
|
+
op.data.recv_message.recv_message = &recv_message_payload_;
|
1741
1717
|
op.flags = 0;
|
1742
1718
|
op.reserved = nullptr;
|
1743
|
-
GPR_ASSERT(
|
1719
|
+
GPR_ASSERT(call_ != nullptr);
|
1744
1720
|
// Reuse the "OnResponseReceivedLocked" ref taken in ctor.
|
1745
|
-
|
1746
|
-
|
1747
|
-
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1748
|
-
lrs_calld->call_, &op, 1, &lrs_calld->on_response_received_);
|
1721
|
+
const grpc_call_error call_error =
|
1722
|
+
grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
|
1749
1723
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1750
1724
|
}
|
1751
1725
|
|
1752
1726
|
void XdsClient::ChannelState::LrsCallState::OnStatusReceived(
|
1753
1727
|
void* arg, grpc_error* error) {
|
1754
1728
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1729
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1730
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1731
|
+
[lrs_calld, error]() { lrs_calld->OnStatusReceivedLocked(error); },
|
1732
|
+
DEBUG_LOCATION);
|
1759
1733
|
}
|
1760
1734
|
|
1761
1735
|
void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
|
1762
|
-
|
1763
|
-
|
1764
|
-
XdsClient* xds_client = lrs_calld->xds_client();
|
1765
|
-
ChannelState* chand = lrs_calld->chand();
|
1766
|
-
GPR_ASSERT(lrs_calld->call_ != nullptr);
|
1736
|
+
grpc_error* error) {
|
1737
|
+
GPR_ASSERT(call_ != nullptr);
|
1767
1738
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1768
|
-
char* status_details = grpc_slice_to_c_string(
|
1739
|
+
char* status_details = grpc_slice_to_c_string(status_details_);
|
1769
1740
|
gpr_log(GPR_INFO,
|
1770
1741
|
"[xds_client %p] LRS call status received. Status = %d, details "
|
1771
1742
|
"= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
|
1772
|
-
xds_client,
|
1773
|
-
|
1743
|
+
xds_client(), status_code_, status_details, chand(), this, call_,
|
1744
|
+
grpc_error_string(error));
|
1774
1745
|
gpr_free(status_details);
|
1775
1746
|
}
|
1776
1747
|
// Ignore status from a stale call.
|
1777
|
-
if (
|
1778
|
-
GPR_ASSERT(!xds_client->shutting_down_);
|
1748
|
+
if (IsCurrentCallOnChannel()) {
|
1749
|
+
GPR_ASSERT(!xds_client()->shutting_down_);
|
1779
1750
|
// Try to restart the call.
|
1780
|
-
|
1751
|
+
parent_->OnCallFinishedLocked();
|
1781
1752
|
}
|
1782
|
-
|
1753
|
+
Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked");
|
1754
|
+
GRPC_ERROR_UNREF(error);
|
1783
1755
|
}
|
1784
1756
|
|
1785
1757
|
bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
|
@@ -1803,13 +1775,14 @@ grpc_millis GetRequestTimeout(const grpc_channel_args& args) {
|
|
1803
1775
|
|
1804
1776
|
} // namespace
|
1805
1777
|
|
1806
|
-
XdsClient::XdsClient(
|
1807
|
-
|
1778
|
+
XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
|
1779
|
+
grpc_pollset_set* interested_parties,
|
1780
|
+
absl::string_view server_name,
|
1808
1781
|
std::unique_ptr<ServiceConfigWatcherInterface> watcher,
|
1809
1782
|
const grpc_channel_args& channel_args, grpc_error** error)
|
1810
1783
|
: InternallyRefCounted<XdsClient>(&grpc_xds_client_trace),
|
1811
1784
|
request_timeout_(GetRequestTimeout(channel_args)),
|
1812
|
-
|
1785
|
+
work_serializer_(std::move(work_serializer)),
|
1813
1786
|
interested_parties_(interested_parties),
|
1814
1787
|
bootstrap_(
|
1815
1788
|
XdsBootstrap::ReadFromFile(this, &grpc_xds_client_trace, error)),
|
@@ -1848,7 +1821,6 @@ XdsClient::~XdsClient() {
|
|
1848
1821
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1849
1822
|
gpr_log(GPR_INFO, "[xds_client %p] destroying xds client", this);
|
1850
1823
|
}
|
1851
|
-
GRPC_COMBINER_UNREF(combiner_, "xds_client");
|
1852
1824
|
}
|
1853
1825
|
|
1854
1826
|
void XdsClient::Orphan() {
|
@@ -1871,7 +1843,8 @@ void XdsClient::Orphan() {
|
|
1871
1843
|
}
|
1872
1844
|
|
1873
1845
|
void XdsClient::WatchClusterData(
|
1874
|
-
|
1846
|
+
absl::string_view cluster_name,
|
1847
|
+
std::unique_ptr<ClusterWatcherInterface> watcher) {
|
1875
1848
|
std::string cluster_name_str = std::string(cluster_name);
|
1876
1849
|
ClusterState& cluster_state = cluster_map_[cluster_name_str];
|
1877
1850
|
ClusterWatcherInterface* w = watcher.get();
|
@@ -1881,14 +1854,14 @@ void XdsClient::WatchClusterData(
|
|
1881
1854
|
if (cluster_state.update.has_value()) {
|
1882
1855
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1883
1856
|
gpr_log(GPR_INFO, "[xds_client %p] returning cached cluster data for %s",
|
1884
|
-
this,
|
1857
|
+
this, cluster_name_str.c_str());
|
1885
1858
|
}
|
1886
1859
|
w->OnClusterChanged(cluster_state.update.value());
|
1887
1860
|
}
|
1888
1861
|
chand_->Subscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
|
1889
1862
|
}
|
1890
1863
|
|
1891
|
-
void XdsClient::CancelClusterDataWatch(
|
1864
|
+
void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
|
1892
1865
|
ClusterWatcherInterface* watcher,
|
1893
1866
|
bool delay_unsubscription) {
|
1894
1867
|
if (shutting_down_) return;
|
@@ -1906,7 +1879,7 @@ void XdsClient::CancelClusterDataWatch(StringView cluster_name,
|
|
1906
1879
|
}
|
1907
1880
|
|
1908
1881
|
void XdsClient::WatchEndpointData(
|
1909
|
-
|
1882
|
+
absl::string_view eds_service_name,
|
1910
1883
|
std::unique_ptr<EndpointWatcherInterface> watcher) {
|
1911
1884
|
std::string eds_service_name_str = std::string(eds_service_name);
|
1912
1885
|
EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
|
@@ -1917,14 +1890,14 @@ void XdsClient::WatchEndpointData(
|
|
1917
1890
|
if (endpoint_state.update.has_value()) {
|
1918
1891
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1919
1892
|
gpr_log(GPR_INFO, "[xds_client %p] returning cached endpoint data for %s",
|
1920
|
-
this,
|
1893
|
+
this, eds_service_name_str.c_str());
|
1921
1894
|
}
|
1922
1895
|
w->OnEndpointChanged(endpoint_state.update.value());
|
1923
1896
|
}
|
1924
1897
|
chand_->Subscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
|
1925
1898
|
}
|
1926
1899
|
|
1927
|
-
void XdsClient::CancelEndpointDataWatch(
|
1900
|
+
void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
|
1928
1901
|
EndpointWatcherInterface* watcher,
|
1929
1902
|
bool delay_unsubscription) {
|
1930
1903
|
if (shutting_down_) return;
|
@@ -1942,13 +1915,13 @@ void XdsClient::CancelEndpointDataWatch(StringView eds_service_name,
|
|
1942
1915
|
}
|
1943
1916
|
|
1944
1917
|
RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
|
1945
|
-
|
1946
|
-
|
1918
|
+
absl::string_view lrs_server, absl::string_view cluster_name,
|
1919
|
+
absl::string_view eds_service_name) {
|
1947
1920
|
// TODO(roth): When we add support for direct federation, use the
|
1948
1921
|
// server name specified in lrs_server.
|
1949
1922
|
auto key =
|
1950
1923
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name));
|
1951
|
-
// We jump through some hoops here to make sure that the
|
1924
|
+
// We jump through some hoops here to make sure that the absl::string_views
|
1952
1925
|
// stored in the XdsClusterDropStats object point to the strings
|
1953
1926
|
// in the load_report_map_ key, so that they have the same lifetime.
|
1954
1927
|
auto it = load_report_map_
|
@@ -1963,8 +1936,9 @@ RefCountedPtr
|
|
1963
1936
|
}
|
1964
1937
|
|
1965
1938
|
void XdsClient::RemoveClusterDropStats(
|
1966
|
-
|
1967
|
-
|
1939
|
+
absl::string_view /*lrs_server*/, absl::string_view cluster_name,
|
1940
|
+
absl::string_view eds_service_name,
|
1941
|
+
XdsClusterDropStats* cluster_drop_stats) {
|
1968
1942
|
auto load_report_it = load_report_map_.find(
|
1969
1943
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
|
1970
1944
|
if (load_report_it == load_report_map_.end()) return;
|
@@ -1983,13 +1957,14 @@ void XdsClient::RemoveClusterDropStats(
|
|
1983
1957
|
}
|
1984
1958
|
|
1985
1959
|
RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
|
1986
|
-
|
1960
|
+
absl::string_view lrs_server, absl::string_view cluster_name,
|
1961
|
+
absl::string_view eds_service_name,
|
1987
1962
|
RefCountedPtr<XdsLocalityName> locality) {
|
1988
1963
|
// TODO(roth): When we add support for direct federation, use the
|
1989
1964
|
// server name specified in lrs_server.
|
1990
1965
|
auto key =
|
1991
1966
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name));
|
1992
|
-
// We jump through some hoops here to make sure that the
|
1967
|
+
// We jump through some hoops here to make sure that the absl::string_views
|
1993
1968
|
// stored in the XdsClusterLocalityStats object point to the strings
|
1994
1969
|
// in the load_report_map_ key, so that they have the same lifetime.
|
1995
1970
|
auto it = load_report_map_
|
@@ -2006,8 +1981,9 @@ RefCountedPtr
|
|
2006
1981
|
}
|
2007
1982
|
|
2008
1983
|
void XdsClient::RemoveClusterLocalityStats(
|
2009
|
-
|
2010
|
-
|
1984
|
+
absl::string_view /*lrs_server*/, absl::string_view cluster_name,
|
1985
|
+
absl::string_view eds_service_name,
|
1986
|
+
const RefCountedPtr<XdsLocalityName>& locality,
|
2011
1987
|
XdsClusterLocalityStats* cluster_locality_stats) {
|
2012
1988
|
auto load_report_it = load_report_map_.find(
|
2013
1989
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
|
@@ -2034,27 +2010,238 @@ void XdsClient::ResetBackoff() {
|
|
2034
2010
|
}
|
2035
2011
|
}
|
2036
2012
|
|
2013
|
+
namespace {
|
2014
|
+
std::string CreateServiceConfigActionCluster(const std::string& cluster_name) {
|
2015
|
+
return absl::StrFormat(
|
2016
|
+
" \"cds:%s\":{\n"
|
2017
|
+
" \"childPolicy\":[ {\n"
|
2018
|
+
" \"cds_experimental\":{\n"
|
2019
|
+
" \"cluster\": \"%s\"\n"
|
2020
|
+
" }\n"
|
2021
|
+
" } ]\n"
|
2022
|
+
" }",
|
2023
|
+
cluster_name, cluster_name);
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
std::string CreateServiceConfigRoute(const std::string& action_name,
|
2027
|
+
const std::string& service,
|
2028
|
+
const std::string& method) {
|
2029
|
+
return absl::StrFormat(
|
2030
|
+
" { \n"
|
2031
|
+
" \"methodName\": {\n"
|
2032
|
+
" \"service\": \"%s\",\n"
|
2033
|
+
" \"method\": \"%s\"\n"
|
2034
|
+
" },\n"
|
2035
|
+
" \"action\": \"%s\"\n"
|
2036
|
+
" }",
|
2037
|
+
service, method, action_name);
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
// Create the service config for one weighted cluster.
|
2041
|
+
std::string CreateServiceConfigActionWeightedCluster(
|
2042
|
+
const std::string& name,
|
2043
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& clusters) {
|
2044
|
+
std::vector<std::string> config_parts;
|
2045
|
+
config_parts.push_back(
|
2046
|
+
absl::StrFormat(" \"weighted:%s\":{\n"
|
2047
|
+
" \"childPolicy\":[ {\n"
|
2048
|
+
" \"weighted_target_experimental\":{\n"
|
2049
|
+
" \"targets\":{\n",
|
2050
|
+
name));
|
2051
|
+
std::vector<std::string> weighted_targets;
|
2052
|
+
weighted_targets.reserve(clusters.size());
|
2053
|
+
for (const auto& cluster_weight : clusters) {
|
2054
|
+
weighted_targets.push_back(absl::StrFormat(
|
2055
|
+
" \"%s\":{\n"
|
2056
|
+
" \"weight\":%d,\n"
|
2057
|
+
" \"childPolicy\":[ {\n"
|
2058
|
+
" \"cds_experimental\":{\n"
|
2059
|
+
" \"cluster\": \"%s\"\n"
|
2060
|
+
" }\n"
|
2061
|
+
" } ]\n"
|
2062
|
+
" }",
|
2063
|
+
cluster_weight.name, cluster_weight.weight, cluster_weight.name));
|
2064
|
+
}
|
2065
|
+
config_parts.push_back(absl::StrJoin(weighted_targets, ",\n"));
|
2066
|
+
config_parts.push_back(
|
2067
|
+
" }\n"
|
2068
|
+
" }\n"
|
2069
|
+
" } ]\n"
|
2070
|
+
" }");
|
2071
|
+
return absl::StrJoin(config_parts, "");
|
2072
|
+
}
|
2073
|
+
|
2074
|
+
struct WeightedClustersKeys {
|
2075
|
+
std::string cluster_names_key;
|
2076
|
+
std::string cluster_weights_key;
|
2077
|
+
};
|
2078
|
+
|
2079
|
+
// Returns the cluster names and weights key or the cluster names only key.
|
2080
|
+
WeightedClustersKeys GetWeightedClustersKey(
|
2081
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2082
|
+
weighted_clusters) {
|
2083
|
+
std::set<std::string> cluster_names;
|
2084
|
+
std::set<std::string> cluster_weights;
|
2085
|
+
for (const auto& cluster_weight : weighted_clusters) {
|
2086
|
+
cluster_names.emplace(absl::StrFormat("%s", cluster_weight.name));
|
2087
|
+
cluster_weights.emplace(
|
2088
|
+
absl::StrFormat("%s_%d", cluster_weight.name, cluster_weight.weight));
|
2089
|
+
}
|
2090
|
+
return {absl::StrJoin(cluster_names, "_"),
|
2091
|
+
absl::StrJoin(cluster_weights, "_")};
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
} // namespace
|
2095
|
+
|
2096
|
+
std::string XdsClient::WeightedClustersActionName(
|
2097
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2098
|
+
weighted_clusters) {
|
2099
|
+
WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters);
|
2100
|
+
auto cluster_names_map_it =
|
2101
|
+
weighted_cluster_index_map_.find(keys.cluster_names_key);
|
2102
|
+
GPR_ASSERT(cluster_names_map_it != weighted_cluster_index_map_.end());
|
2103
|
+
const auto& cluster_weights_map =
|
2104
|
+
cluster_names_map_it->second.cluster_weights_map;
|
2105
|
+
auto cluster_weights_map_it =
|
2106
|
+
cluster_weights_map.find(keys.cluster_weights_key);
|
2107
|
+
GPR_ASSERT(cluster_weights_map_it != cluster_weights_map.end());
|
2108
|
+
return absl::StrFormat("%s_%d", keys.cluster_names_key,
|
2109
|
+
cluster_weights_map_it->second);
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
void XdsClient::UpdateWeightedClusterIndexMap(
|
2113
|
+
const XdsApi::RdsUpdate& rds_update) {
|
2114
|
+
// Construct a list of unique WeightedCluster
|
2115
|
+
// actions which we need to process: to find action names
|
2116
|
+
std::map<std::string /* cluster_weights_key */,
|
2117
|
+
std::string /* cluster_names_key */>
|
2118
|
+
actions_to_process;
|
2119
|
+
for (const auto& route : rds_update.routes) {
|
2120
|
+
if (!route.weighted_clusters.empty()) {
|
2121
|
+
WeightedClustersKeys keys =
|
2122
|
+
GetWeightedClustersKey(route.weighted_clusters);
|
2123
|
+
auto action_it = actions_to_process.find(keys.cluster_weights_key);
|
2124
|
+
if (action_it == actions_to_process.end()) {
|
2125
|
+
actions_to_process[std::move(keys.cluster_weights_key)] =
|
2126
|
+
std::move(keys.cluster_names_key);
|
2127
|
+
}
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
// First pass of all unique WeightedCluster actions: if the exact same
|
2131
|
+
// weighted target policy (same clusters and weights) appears in the old map,
|
2132
|
+
// then that old action name is taken again and should be moved to the new
|
2133
|
+
// map; any other action names from the old set of actions are candidates for
|
2134
|
+
// reuse.
|
2135
|
+
XdsClient::WeightedClusterIndexMap new_weighted_cluster_index_map;
|
2136
|
+
for (auto action_it = actions_to_process.begin();
|
2137
|
+
action_it != actions_to_process.end();) {
|
2138
|
+
const std::string& cluster_names_key = action_it->second;
|
2139
|
+
const std::string& cluster_weights_key = action_it->first;
|
2140
|
+
auto old_cluster_names_map_it =
|
2141
|
+
weighted_cluster_index_map_.find(cluster_names_key);
|
2142
|
+
if (old_cluster_names_map_it != weighted_cluster_index_map_.end()) {
|
2143
|
+
// Add cluster_names_key to the new map and copy next_index.
|
2144
|
+
auto& new_cluster_names_info =
|
2145
|
+
new_weighted_cluster_index_map[cluster_names_key];
|
2146
|
+
new_cluster_names_info.next_index =
|
2147
|
+
old_cluster_names_map_it->second.next_index;
|
2148
|
+
// Lookup cluster_weights_key in old map.
|
2149
|
+
auto& old_cluster_weights_map =
|
2150
|
+
old_cluster_names_map_it->second.cluster_weights_map;
|
2151
|
+
auto old_cluster_weights_map_it =
|
2152
|
+
old_cluster_weights_map.find(cluster_weights_key);
|
2153
|
+
if (old_cluster_weights_map_it != old_cluster_weights_map.end()) {
|
2154
|
+
// same policy found, move from old map to new map.
|
2155
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2156
|
+
old_cluster_weights_map_it->second;
|
2157
|
+
old_cluster_weights_map.erase(old_cluster_weights_map_it);
|
2158
|
+
// This action has been added to new map, so no need to process it
|
2159
|
+
// again.
|
2160
|
+
action_it = actions_to_process.erase(action_it);
|
2161
|
+
continue;
|
2162
|
+
}
|
2163
|
+
}
|
2164
|
+
++action_it;
|
2165
|
+
}
|
2166
|
+
// Second pass of all remaining unique WeightedCluster actions: if clusters
|
2167
|
+
// for a new action are the same as an old unused action, reuse the name. If
|
2168
|
+
// clusters differ, use a brand new name.
|
2169
|
+
for (const auto& action : actions_to_process) {
|
2170
|
+
const std::string& cluster_names_key = action.second;
|
2171
|
+
const std::string& cluster_weights_key = action.first;
|
2172
|
+
auto& new_cluster_names_info =
|
2173
|
+
new_weighted_cluster_index_map[cluster_names_key];
|
2174
|
+
auto& old_cluster_weights_map =
|
2175
|
+
weighted_cluster_index_map_[cluster_names_key].cluster_weights_map;
|
2176
|
+
auto old_cluster_weights_it = old_cluster_weights_map.begin();
|
2177
|
+
if (old_cluster_weights_it != old_cluster_weights_map.end()) {
|
2178
|
+
// There is something to reuse: this action uses the same set
|
2179
|
+
// of clusters as a previous action and that action name is not
|
2180
|
+
// already taken.
|
2181
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2182
|
+
old_cluster_weights_it->second;
|
2183
|
+
// Remove the name from being able to reuse again.
|
2184
|
+
old_cluster_weights_map.erase(old_cluster_weights_it);
|
2185
|
+
} else {
|
2186
|
+
// There is nothing to reuse, take the next index to use and
|
2187
|
+
// increment.
|
2188
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2189
|
+
new_cluster_names_info.next_index++;
|
2190
|
+
}
|
2191
|
+
}
|
2192
|
+
weighted_cluster_index_map_ = std::move(new_weighted_cluster_index_map);
|
2193
|
+
}
|
2194
|
+
|
2037
2195
|
grpc_error* XdsClient::CreateServiceConfig(
|
2038
|
-
const
|
2039
|
-
RefCountedPtr<ServiceConfig>* service_config)
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2196
|
+
const XdsApi::RdsUpdate& rds_update,
|
2197
|
+
RefCountedPtr<ServiceConfig>* service_config) {
|
2198
|
+
UpdateWeightedClusterIndexMap(rds_update);
|
2199
|
+
std::vector<std::string> actions_vector;
|
2200
|
+
std::vector<std::string> route_table;
|
2201
|
+
std::set<std::string> actions_set;
|
2202
|
+
for (const auto& route : rds_update.routes) {
|
2203
|
+
const std::string action_name =
|
2204
|
+
route.weighted_clusters.empty()
|
2205
|
+
? route.cluster_name
|
2206
|
+
: WeightedClustersActionName(route.weighted_clusters);
|
2207
|
+
if (actions_set.find(action_name) == actions_set.end()) {
|
2208
|
+
actions_set.emplace(action_name);
|
2209
|
+
actions_vector.push_back(
|
2210
|
+
route.weighted_clusters.empty()
|
2211
|
+
? CreateServiceConfigActionCluster(action_name)
|
2212
|
+
: CreateServiceConfigActionWeightedCluster(
|
2213
|
+
action_name, route.weighted_clusters));
|
2214
|
+
}
|
2215
|
+
route_table.push_back(CreateServiceConfigRoute(
|
2216
|
+
absl::StrFormat("%s:%s",
|
2217
|
+
route.weighted_clusters.empty() ? "cds" : "weighted",
|
2218
|
+
action_name),
|
2219
|
+
route.service, route.method));
|
2220
|
+
}
|
2221
|
+
std::vector<std::string> config_parts;
|
2222
|
+
config_parts.push_back(
|
2223
|
+
"{\n"
|
2224
|
+
" \"loadBalancingConfig\":[\n"
|
2225
|
+
" { \"xds_routing_experimental\":{\n"
|
2226
|
+
" \"actions\":{\n");
|
2227
|
+
config_parts.push_back(absl::StrJoin(actions_vector, ",\n"));
|
2228
|
+
config_parts.push_back(
|
2229
|
+
" },\n"
|
2230
|
+
" \"routes\":[\n");
|
2231
|
+
config_parts.push_back(absl::StrJoin(route_table, ",\n"));
|
2232
|
+
config_parts.push_back(
|
2233
|
+
" ]\n"
|
2234
|
+
" } }\n"
|
2235
|
+
" ]\n"
|
2236
|
+
"}");
|
2237
|
+
std::string json = absl::StrJoin(config_parts, "");
|
2050
2238
|
grpc_error* error = GRPC_ERROR_NONE;
|
2051
|
-
*service_config = ServiceConfig::Create(json, &error);
|
2052
|
-
gpr_free(json);
|
2239
|
+
*service_config = ServiceConfig::Create(json.c_str(), &error);
|
2053
2240
|
return error;
|
2054
2241
|
}
|
2055
2242
|
|
2056
2243
|
XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
2057
|
-
const std::set<std::string>& clusters) {
|
2244
|
+
bool send_all_clusters, const std::set<std::string>& clusters) {
|
2058
2245
|
XdsApi::ClusterLoadReportMap snapshot_map;
|
2059
2246
|
for (auto load_report_it = load_report_map_.begin();
|
2060
2247
|
load_report_it != load_report_map_.end();) {
|
@@ -2069,7 +2256,7 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
|
2069
2256
|
// asking for the data in the future, we don't incorrectly include
|
2070
2257
|
// data from previous reporting intervals in that future report.
|
2071
2258
|
const bool record_stats =
|
2072
|
-
clusters.find(cluster_key.first) != clusters.end();
|
2259
|
+
send_all_clusters || clusters.find(cluster_key.first) != clusters.end();
|
2073
2260
|
XdsApi::ClusterLoadReport snapshot;
|
2074
2261
|
// Aggregate drop stats.
|
2075
2262
|
snapshot.dropped_requests = std::move(load_report.deleted_drop_stats);
|
@@ -2171,4 +2358,10 @@ RefCountedPtr
|
|
2171
2358
|
return nullptr;
|
2172
2359
|
}
|
2173
2360
|
|
2361
|
+
grpc_channel_args* XdsClient::RemoveFromChannelArgs(
|
2362
|
+
const grpc_channel_args& args) {
|
2363
|
+
const char* arg_name = GRPC_ARG_XDS_CLIENT;
|
2364
|
+
return grpc_channel_args_copy_and_remove(&args, &arg_name, 1);
|
2365
|
+
}
|
2366
|
+
|
2174
2367
|
} // namespace grpc_core
|