grpc 1.60.2 → 1.61.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +208 -165
- data/include/grpc/event_engine/event_engine.h +59 -12
- data/include/grpc/event_engine/internal/memory_allocator_impl.h +6 -0
- data/include/grpc/event_engine/internal/slice_cast.h +12 -0
- data/include/grpc/event_engine/memory_allocator.h +3 -1
- data/include/grpc/event_engine/slice.h +5 -0
- data/include/grpc/grpc_security.h +22 -1
- data/include/grpc/impl/call.h +29 -0
- data/include/grpc/impl/channel_arg_names.h +12 -1
- data/include/grpc/impl/slice_type.h +1 -1
- data/include/grpc/module.modulemap +1 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +54 -7
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +20 -6
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +10 -13
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +18 -10
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +326 -0
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.h +143 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +32 -6
- data/src/core/ext/filters/client_channel/client_channel_internal.h +2 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +54 -21
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +12 -15
- data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +8 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +139 -92
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +9 -4
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +9 -4
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +10 -11
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +94 -93
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +5 -3
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +12 -15
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +38 -16
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +25 -28
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +10 -10
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +37 -35
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +504 -461
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +232 -122
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +8 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +642 -251
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +2 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +7 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +6 -8
- data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.cc +1031 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.h +277 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +128 -270
- data/src/core/ext/filters/client_channel/resolver/xds/{xds_resolver.h → xds_resolver_attributes.h} +5 -4
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.cc +25 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.h +30 -0
- data/src/core/ext/filters/client_channel/retry_filter.cc +1 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +35 -17
- data/src/core/ext/filters/deadline/deadline_filter.cc +12 -0
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +17 -13
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +13 -4
- data/src/core/ext/filters/http/client/http_client_filter.cc +23 -32
- data/src/core/ext/filters/http/client/http_client_filter.h +10 -5
- data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
- data/src/core/ext/filters/http/client_authority_filter.h +12 -4
- data/src/core/ext/filters/http/http_filters_plugin.cc +42 -20
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +55 -80
- data/src/core/ext/filters/http/message_compress/compression_filter.h +54 -12
- data/src/core/ext/filters/http/message_compress/legacy_compression_filter.cc +325 -0
- data/src/core/ext/filters/http/message_compress/legacy_compression_filter.h +139 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +41 -41
- data/src/core/ext/filters/http/server/http_server_filter.h +11 -4
- data/src/core/ext/filters/message_size/message_size_filter.cc +56 -76
- data/src/core/ext/filters/message_size/message_size_filter.h +35 -23
- data/src/core/ext/filters/rbac/rbac_filter.cc +15 -11
- data/src/core/ext/filters/rbac/rbac_filter.h +11 -4
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +25 -13
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +47 -50
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +21 -4
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +11 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +68 -145
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +21 -82
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -8
- data/src/core/ext/transport/chttp2/transport/frame.cc +506 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +214 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +33 -79
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -7
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -36
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +0 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +122 -32
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +142 -37
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -22
- data/src/core/ext/transport/chttp2/transport/parsing.cc +23 -37
- data/src/core/ext/transport/chttp2/transport/writing.cc +26 -58
- data/src/core/ext/transport/inproc/inproc_transport.cc +172 -13
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +712 -0
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +151 -0
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +33 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +133 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +50 -0
- data/src/core/ext/xds/certificate_provider_store.cc +2 -1
- data/src/core/ext/xds/certificate_provider_store.h +0 -5
- data/src/core/ext/xds/xds_api.cc +31 -18
- data/src/core/ext/xds/xds_api.h +2 -2
- data/src/core/ext/xds/xds_bootstrap.h +3 -0
- data/src/core/ext/xds/xds_certificate_provider.cc +88 -287
- data/src/core/ext/xds/xds_certificate_provider.h +44 -111
- data/src/core/ext/xds/xds_client.cc +420 -414
- data/src/core/ext/xds/xds_client.h +31 -22
- data/src/core/ext/xds/xds_client_grpc.cc +3 -1
- data/src/core/ext/xds/xds_cluster.cc +104 -11
- data/src/core/ext/xds/xds_cluster.h +9 -1
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +9 -5
- data/src/core/ext/xds/xds_common_types.cc +14 -10
- data/src/core/ext/xds/xds_endpoint.cc +9 -4
- data/src/core/ext/xds/xds_endpoint.h +5 -1
- data/src/core/ext/xds/xds_health_status.cc +12 -2
- data/src/core/ext/xds/xds_health_status.h +4 -2
- data/src/core/ext/xds/xds_http_rbac_filter.cc +5 -3
- data/src/core/ext/xds/xds_listener.cc +14 -8
- data/src/core/ext/xds/xds_resource_type_impl.h +6 -4
- data/src/core/ext/xds/xds_route_config.cc +34 -22
- data/src/core/ext/xds/xds_route_config.h +1 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +61 -57
- data/src/core/ext/xds/xds_transport.h +3 -0
- data/src/core/ext/xds/xds_transport_grpc.cc +47 -50
- data/src/core/ext/xds/xds_transport_grpc.h +4 -0
- data/src/core/lib/channel/call_tracer.cc +12 -0
- data/src/core/lib/channel/call_tracer.h +17 -3
- data/src/core/lib/channel/channel_args.cc +24 -14
- data/src/core/lib/channel/channel_args.h +74 -13
- data/src/core/lib/channel/channel_stack.cc +27 -0
- data/src/core/lib/channel/channel_stack.h +10 -10
- data/src/core/lib/channel/connected_channel.cc +64 -18
- data/src/core/lib/channel/promise_based_filter.h +1041 -1
- data/src/core/lib/channel/server_call_tracer_filter.cc +43 -35
- data/src/core/lib/compression/compression_internal.cc +0 -3
- data/src/core/lib/event_engine/ares_resolver.cc +35 -14
- data/src/core/lib/event_engine/ares_resolver.h +9 -10
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +8 -1
- data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +132 -0
- data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +61 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +52 -36
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +4 -9
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +11 -3
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +9 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +7 -0
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +17 -27
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +0 -3
- data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +55 -0
- data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +114 -0
- data/src/core/lib/event_engine/windows/native_windows_dns_resolver.h +51 -0
- data/src/core/lib/event_engine/windows/windows_engine.cc +7 -7
- data/src/core/lib/experiments/config.cc +13 -0
- data/src/core/lib/experiments/config.h +3 -0
- data/src/core/lib/experiments/experiments.cc +245 -366
- data/src/core/lib/experiments/experiments.h +50 -156
- data/src/core/lib/gprpp/debug_location.h +13 -0
- data/src/core/lib/gprpp/dual_ref_counted.h +36 -7
- data/src/core/lib/gprpp/orphanable.h +27 -0
- data/src/core/lib/gprpp/ref_counted.h +63 -22
- data/src/core/lib/gprpp/ref_counted_ptr.h +70 -27
- data/src/core/lib/gprpp/ref_counted_string.h +13 -0
- data/src/core/lib/gprpp/status_helper.cc +1 -2
- data/src/core/lib/iomgr/combiner.cc +15 -51
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +31 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +16 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -3
- data/src/core/lib/load_balancing/lb_policy.h +1 -1
- data/src/core/lib/promise/activity.cc +17 -2
- data/src/core/lib/promise/activity.h +5 -4
- data/src/core/lib/promise/all_ok.h +80 -0
- data/src/core/lib/promise/detail/join_state.h +2077 -0
- data/src/core/lib/promise/detail/promise_factory.h +1 -0
- data/src/core/lib/promise/detail/promise_like.h +8 -1
- data/src/core/lib/promise/detail/seq_state.h +3458 -150
- data/src/core/lib/promise/detail/status.h +42 -5
- data/src/core/lib/promise/for_each.h +13 -1
- data/src/core/lib/promise/if.h +4 -0
- data/src/core/lib/promise/latch.h +6 -3
- data/src/core/lib/promise/party.cc +33 -31
- data/src/core/lib/promise/party.h +142 -6
- data/src/core/lib/promise/poll.h +39 -13
- data/src/core/lib/promise/promise.h +4 -0
- data/src/core/lib/promise/seq.h +107 -7
- data/src/core/lib/promise/status_flag.h +196 -0
- data/src/core/lib/promise/try_join.h +132 -0
- data/src/core/lib/promise/try_seq.h +132 -10
- data/src/core/lib/resolver/endpoint_addresses.cc +0 -1
- data/src/core/lib/resolver/endpoint_addresses.h +48 -0
- data/src/core/lib/resource_quota/arena.h +2 -2
- data/src/core/lib/resource_quota/memory_quota.cc +57 -8
- data/src/core/lib/resource_quota/memory_quota.h +6 -0
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +14 -11
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +14 -5
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +4 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +4 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +28 -20
- data/src/core/lib/security/credentials/external/external_account_credentials.h +4 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +4 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +4 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +4 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +4 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +0 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +12 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +22 -5
- data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -5
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +16 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +21 -28
- data/src/core/lib/security/credentials/xds/xds_credentials.h +2 -4
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +4 -3
- data/src/core/lib/security/transport/auth_filters.h +71 -4
- data/src/core/lib/security/transport/client_auth_filter.cc +2 -4
- data/src/core/lib/security/transport/legacy_server_auth_filter.cc +244 -0
- data/src/core/lib/security/transport/server_auth_filter.cc +70 -90
- data/src/core/lib/slice/slice_buffer.h +3 -0
- data/src/core/lib/surface/builtins.cc +1 -1
- data/src/core/lib/surface/call.cc +683 -196
- data/src/core/lib/surface/call.h +26 -13
- data/src/core/lib/surface/call_trace.cc +42 -1
- data/src/core/lib/surface/channel.cc +0 -1
- data/src/core/lib/surface/channel.h +0 -6
- data/src/core/lib/surface/channel_init.h +26 -0
- data/src/core/lib/surface/init.cc +14 -8
- data/src/core/lib/surface/server.cc +256 -237
- data/src/core/lib/surface/server.h +26 -54
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/surface/wait_for_cq_end_op.h +94 -0
- data/src/core/lib/transport/call_final_info.cc +38 -0
- data/src/core/lib/transport/call_final_info.h +54 -0
- data/src/core/lib/transport/connectivity_state.cc +3 -2
- data/src/core/lib/transport/connectivity_state.h +4 -0
- data/src/core/lib/transport/metadata_batch.h +4 -4
- data/src/core/lib/transport/transport.cc +70 -19
- data/src/core/lib/transport/transport.h +395 -25
- data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -0
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +65 -43
- data/src/ruby/ext/grpc/rb_channel_args.c +3 -1
- data/src/ruby/ext/grpc/rb_grpc.c +0 -1
- data/src/ruby/ext/grpc/rb_grpc.h +0 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/upb/upb/reflection/def_pool.h +2 -2
- data/third_party/zlib/adler32.c +5 -27
- data/third_party/zlib/compress.c +5 -16
- data/third_party/zlib/crc32.c +86 -162
- data/third_party/zlib/deflate.c +233 -336
- data/third_party/zlib/deflate.h +8 -8
- data/third_party/zlib/gzguts.h +11 -12
- data/third_party/zlib/infback.c +7 -23
- data/third_party/zlib/inffast.c +1 -4
- data/third_party/zlib/inffast.h +1 -1
- data/third_party/zlib/inflate.c +30 -99
- data/third_party/zlib/inftrees.c +6 -11
- data/third_party/zlib/inftrees.h +3 -3
- data/third_party/zlib/trees.c +224 -302
- data/third_party/zlib/uncompr.c +4 -12
- data/third_party/zlib/zconf.h +6 -2
- data/third_party/zlib/zlib.h +191 -188
- data/third_party/zlib/zutil.c +16 -44
- data/third_party/zlib/zutil.h +10 -10
- metadata +35 -13
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +0 -1173
- data/src/core/lib/event_engine/memory_allocator.cc +0 -74
- data/src/core/lib/transport/pid_controller.cc +0 -51
- data/src/core/lib/transport/pid_controller.h +0 -116
- data/third_party/upb/upb/collections/array.h +0 -17
- data/third_party/upb/upb/collections/map.h +0 -17
- data/third_party/upb/upb/upb.hpp +0 -18
@@ -49,7 +49,7 @@
|
|
49
49
|
#include "absl/strings/string_view.h"
|
50
50
|
#include "absl/types/optional.h"
|
51
51
|
#include "upb/base/string_view.h"
|
52
|
-
#include "upb/
|
52
|
+
#include "upb/mem/arena.hpp"
|
53
53
|
|
54
54
|
#include <grpc/byte_buffer.h>
|
55
55
|
#include <grpc/byte_buffer_reader.h>
|
@@ -707,7 +707,7 @@ class RlsLb : public LoadBalancingPolicy {
|
|
707
707
|
OrphanablePtr<RlsChannel> rls_channel_ ABSL_GUARDED_BY(mu_);
|
708
708
|
|
709
709
|
// Accessed only from within WorkSerializer.
|
710
|
-
absl::StatusOr<
|
710
|
+
absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>> addresses_;
|
711
711
|
ChannelArgs channel_args_;
|
712
712
|
RefCountedPtr<RlsLbConfig> config_;
|
713
713
|
RefCountedPtr<ChildPolicyWrapper> default_child_policy_;
|
@@ -1282,7 +1282,7 @@ RlsLb::Cache::Entry::OnRlsResponseLocked(
|
|
1282
1282
|
auto it = lb_policy_->child_policy_map_.find(target);
|
1283
1283
|
if (it == lb_policy_->child_policy_map_.end()) {
|
1284
1284
|
auto new_child = MakeRefCounted<ChildPolicyWrapper>(
|
1285
|
-
lb_policy_
|
1285
|
+
lb_policy_.Ref(DEBUG_LOCATION, "ChildPolicyWrapper"), target);
|
1286
1286
|
new_child->StartUpdate();
|
1287
1287
|
child_policies_to_finish_update.push_back(new_child.get());
|
1288
1288
|
new_child_policy_wrappers.emplace_back(std::move(new_child));
|
@@ -1326,8 +1326,8 @@ RlsLb::Cache::Entry* RlsLb::Cache::FindOrInsert(const RequestKey& key) {
|
|
1326
1326
|
if (it == map_.end()) {
|
1327
1327
|
size_t entry_size = EntrySizeForKey(key);
|
1328
1328
|
MaybeShrinkSize(size_limit_ - std::min(size_limit_, entry_size));
|
1329
|
-
Entry* entry =
|
1330
|
-
|
1329
|
+
Entry* entry = new Entry(
|
1330
|
+
lb_policy_->RefAsSubclass<RlsLb>(DEBUG_LOCATION, "CacheEntry"), key);
|
1331
1331
|
map_.emplace(key, OrphanablePtr<Entry>(entry));
|
1332
1332
|
size_ += entry_size;
|
1333
1333
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_rls_trace)) {
|
@@ -1550,11 +1550,11 @@ RlsLb::RlsChannel::RlsChannel(RefCountedPtr<RlsLb> lb_policy)
|
|
1550
1550
|
// Set up channelz linkage.
|
1551
1551
|
channelz::ChannelNode* child_channelz_node =
|
1552
1552
|
grpc_channel_get_channelz_node(channel_);
|
1553
|
-
|
1554
|
-
lb_policy_->channel_args_.
|
1553
|
+
auto parent_channelz_node =
|
1554
|
+
lb_policy_->channel_args_.GetObjectRef<channelz::ChannelNode>();
|
1555
1555
|
if (child_channelz_node != nullptr && parent_channelz_node != nullptr) {
|
1556
1556
|
parent_channelz_node->AddChildChannel(child_channelz_node->uuid());
|
1557
|
-
parent_channelz_node_ = parent_channelz_node
|
1557
|
+
parent_channelz_node_ = std::move(parent_channelz_node);
|
1558
1558
|
}
|
1559
1559
|
// Start connectivity watch.
|
1560
1560
|
ClientChannel* client_channel =
|
@@ -1607,7 +1607,7 @@ void RlsLb::RlsChannel::StartRlsCall(const RequestKey& key,
|
|
1607
1607
|
}
|
1608
1608
|
lb_policy_->request_map_.emplace(
|
1609
1609
|
key, MakeOrphanable<RlsRequest>(
|
1610
|
-
lb_policy_
|
1610
|
+
lb_policy_.Ref(DEBUG_LOCATION, "RlsRequest"), key,
|
1611
1611
|
lb_policy_->rls_channel_->Ref(DEBUG_LOCATION, "RlsRequest"),
|
1612
1612
|
std::move(backoff_state), reason, std::move(stale_header_data)));
|
1613
1613
|
}
|
@@ -1858,6 +1858,27 @@ RlsLb::RlsLb(Args args) : LoadBalancingPolicy(std::move(args)), cache_(this) {
|
|
1858
1858
|
}
|
1859
1859
|
}
|
1860
1860
|
|
1861
|
+
bool EndpointsEqual(
|
1862
|
+
const absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>> endpoints1,
|
1863
|
+
const absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>>
|
1864
|
+
endpoints2) {
|
1865
|
+
if (endpoints1.status() != endpoints2.status()) return false;
|
1866
|
+
if (endpoints1.ok()) {
|
1867
|
+
std::vector<EndpointAddresses> e1_list;
|
1868
|
+
(*endpoints1)->ForEach([&](const EndpointAddresses& endpoint) {
|
1869
|
+
e1_list.push_back(endpoint);
|
1870
|
+
});
|
1871
|
+
size_t i = 0;
|
1872
|
+
bool different = false;
|
1873
|
+
(*endpoints2)->ForEach([&](const EndpointAddresses& endpoint) {
|
1874
|
+
if (endpoint != e1_list[i++]) different = true;
|
1875
|
+
});
|
1876
|
+
if (different) return false;
|
1877
|
+
if (i != e1_list.size()) return false;
|
1878
|
+
}
|
1879
|
+
return true;
|
1880
|
+
}
|
1881
|
+
|
1861
1882
|
absl::Status RlsLb::UpdateLocked(UpdateArgs args) {
|
1862
1883
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_rls_trace)) {
|
1863
1884
|
gpr_log(GPR_INFO, "[rlslb %p] policy updated", this);
|
@@ -1865,7 +1886,7 @@ absl::Status RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1865
1886
|
update_in_progress_ = true;
|
1866
1887
|
// Swap out config.
|
1867
1888
|
RefCountedPtr<RlsLbConfig> old_config = std::move(config_);
|
1868
|
-
config_ =
|
1889
|
+
config_ = args.config.TakeAsSubclass<RlsLbConfig>();
|
1869
1890
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_rls_trace) &&
|
1870
1891
|
(old_config == nullptr ||
|
1871
1892
|
old_config->child_policy_config() != config_->child_policy_config())) {
|
@@ -1875,7 +1896,7 @@ absl::Status RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1875
1896
|
// Swap out addresses.
|
1876
1897
|
// If the new address list is an error and we have an existing address list,
|
1877
1898
|
// stick with the existing addresses.
|
1878
|
-
absl::StatusOr<
|
1899
|
+
absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>> old_addresses;
|
1879
1900
|
if (args.addresses.ok()) {
|
1880
1901
|
old_addresses = std::move(addresses_);
|
1881
1902
|
addresses_ = std::move(args.addresses);
|
@@ -1888,7 +1909,7 @@ absl::Status RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1888
1909
|
bool update_child_policies =
|
1889
1910
|
old_config == nullptr ||
|
1890
1911
|
old_config->child_policy_config() != config_->child_policy_config() ||
|
1891
|
-
old_addresses
|
1912
|
+
!EndpointsEqual(old_addresses, addresses_) || args.args != channel_args_;
|
1892
1913
|
// If default target changes, swap out child policy.
|
1893
1914
|
bool created_default_child = false;
|
1894
1915
|
if (old_config == nullptr ||
|
@@ -1905,7 +1926,7 @@ absl::Status RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1905
1926
|
gpr_log(GPR_INFO, "[rlslb %p] creating new default target", this);
|
1906
1927
|
}
|
1907
1928
|
default_child_policy_ = MakeRefCounted<ChildPolicyWrapper>(
|
1908
|
-
|
1929
|
+
RefAsSubclass<RlsLb>(DEBUG_LOCATION, "ChildPolicyWrapper"),
|
1909
1930
|
config_->default_target());
|
1910
1931
|
created_default_child = true;
|
1911
1932
|
} else {
|
@@ -1924,8 +1945,8 @@ absl::Status RlsLb::UpdateLocked(UpdateArgs args) {
|
|
1924
1945
|
// Swap out RLS channel if needed.
|
1925
1946
|
if (old_config == nullptr ||
|
1926
1947
|
config_->lookup_service() != old_config->lookup_service()) {
|
1927
|
-
rls_channel_ =
|
1928
|
-
|
1948
|
+
rls_channel_ = MakeOrphanable<RlsChannel>(
|
1949
|
+
RefAsSubclass<RlsLb>(DEBUG_LOCATION, "RlsChannel"));
|
1929
1950
|
}
|
1930
1951
|
// Resize cache if needed.
|
1931
1952
|
if (old_config == nullptr ||
|
@@ -2095,7 +2116,8 @@ void RlsLb::UpdatePickerLocked() {
|
|
2095
2116
|
status = absl::UnavailableError("no children available");
|
2096
2117
|
}
|
2097
2118
|
channel_control_helper()->UpdateState(
|
2098
|
-
state, status,
|
2119
|
+
state, status,
|
2120
|
+
MakeRefCounted<Picker>(RefAsSubclass<RlsLb>(DEBUG_LOCATION, "Picker")));
|
2099
2121
|
}
|
2100
2122
|
|
2101
2123
|
//
|
@@ -125,14 +125,14 @@ class OldRoundRobin : public LoadBalancingPolicy {
|
|
125
125
|
: public SubchannelList<RoundRobinSubchannelList,
|
126
126
|
RoundRobinSubchannelData> {
|
127
127
|
public:
|
128
|
-
RoundRobinSubchannelList(OldRoundRobin* policy,
|
128
|
+
RoundRobinSubchannelList(OldRoundRobin* policy,
|
129
|
+
EndpointAddressesIterator* addresses,
|
129
130
|
const ChannelArgs& args)
|
130
131
|
: SubchannelList(policy,
|
131
132
|
(GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)
|
132
133
|
? "RoundRobinSubchannelList"
|
133
134
|
: nullptr),
|
134
|
-
|
135
|
-
args) {
|
135
|
+
addresses, policy->channel_control_helper(), args) {
|
136
136
|
// Need to maintain a ref to the LB policy as long as we maintain
|
137
137
|
// any references to subchannels, since the subchannels'
|
138
138
|
// pollset_sets will include the LB policy's pollset_set.
|
@@ -277,13 +277,12 @@ void OldRoundRobin::ResetBackoffLocked() {
|
|
277
277
|
}
|
278
278
|
|
279
279
|
absl::Status OldRoundRobin::UpdateLocked(UpdateArgs args) {
|
280
|
-
|
280
|
+
EndpointAddressesIterator* addresses = nullptr;
|
281
281
|
if (args.addresses.ok()) {
|
282
282
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
283
|
-
gpr_log(GPR_INFO, "[RR %p] received update
|
284
|
-
this, args.addresses->size());
|
283
|
+
gpr_log(GPR_INFO, "[RR %p] received update", this);
|
285
284
|
}
|
286
|
-
addresses =
|
285
|
+
addresses = args.addresses->get();
|
287
286
|
} else {
|
288
287
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
289
288
|
gpr_log(GPR_INFO, "[RR %p] received update with address error: %s", this,
|
@@ -299,8 +298,8 @@ absl::Status OldRoundRobin::UpdateLocked(UpdateArgs args) {
|
|
299
298
|
gpr_log(GPR_INFO, "[RR %p] replacing previous pending subchannel list %p",
|
300
299
|
this, latest_pending_subchannel_list_.get());
|
301
300
|
}
|
302
|
-
latest_pending_subchannel_list_ =
|
303
|
-
this,
|
301
|
+
latest_pending_subchannel_list_ =
|
302
|
+
MakeRefCounted<RoundRobinSubchannelList>(this, addresses, args.args);
|
304
303
|
latest_pending_subchannel_list_->StartWatchingLocked(args.args);
|
305
304
|
// If the new list is empty, immediately promote it to
|
306
305
|
// subchannel_list_ and report TRANSIENT_FAILURE.
|
@@ -405,7 +404,8 @@ void OldRoundRobin::RoundRobinSubchannelList::
|
|
405
404
|
}
|
406
405
|
p->channel_control_helper()->UpdateState(
|
407
406
|
GRPC_CHANNEL_CONNECTING, absl::Status(),
|
408
|
-
MakeRefCounted<QueuePicker>(
|
407
|
+
MakeRefCounted<QueuePicker>(
|
408
|
+
p->RefAsSubclass<OldRoundRobin>(DEBUG_LOCATION, "QueuePicker")));
|
409
409
|
} else if (num_transient_failure_ == num_subchannels()) {
|
410
410
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
411
411
|
gpr_log(GPR_INFO,
|
@@ -524,14 +524,14 @@ class RoundRobin : public LoadBalancingPolicy {
|
|
524
524
|
class RoundRobinEndpointList : public EndpointList {
|
525
525
|
public:
|
526
526
|
RoundRobinEndpointList(RefCountedPtr<RoundRobin> round_robin,
|
527
|
-
|
527
|
+
EndpointAddressesIterator* endpoints,
|
528
528
|
const ChannelArgs& args)
|
529
529
|
: EndpointList(std::move(round_robin),
|
530
530
|
GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)
|
531
531
|
? "RoundRobinEndpointList"
|
532
532
|
: nullptr) {
|
533
533
|
Init(endpoints, args,
|
534
|
-
[&](RefCountedPtr<
|
534
|
+
[&](RefCountedPtr<EndpointList> endpoint_list,
|
535
535
|
const EndpointAddresses& addresses, const ChannelArgs& args) {
|
536
536
|
return MakeOrphanable<RoundRobinEndpoint>(
|
537
537
|
std::move(endpoint_list), addresses, args,
|
@@ -542,7 +542,7 @@ class RoundRobin : public LoadBalancingPolicy {
|
|
542
542
|
private:
|
543
543
|
class RoundRobinEndpoint : public Endpoint {
|
544
544
|
public:
|
545
|
-
RoundRobinEndpoint(RefCountedPtr<
|
545
|
+
RoundRobinEndpoint(RefCountedPtr<EndpointList> endpoint_list,
|
546
546
|
const EndpointAddresses& addresses,
|
547
547
|
const ChannelArgs& args,
|
548
548
|
std::shared_ptr<WorkSerializer> work_serializer)
|
@@ -687,13 +687,12 @@ void RoundRobin::ResetBackoffLocked() {
|
|
687
687
|
}
|
688
688
|
|
689
689
|
absl::Status RoundRobin::UpdateLocked(UpdateArgs args) {
|
690
|
-
|
690
|
+
EndpointAddressesIterator* addresses = nullptr;
|
691
691
|
if (args.addresses.ok()) {
|
692
692
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
693
|
-
gpr_log(GPR_INFO, "[RR %p] received update
|
694
|
-
this, args.addresses->size());
|
693
|
+
gpr_log(GPR_INFO, "[RR %p] received update", this);
|
695
694
|
}
|
696
|
-
addresses =
|
695
|
+
addresses = args.addresses->get();
|
697
696
|
} else {
|
698
697
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
699
698
|
gpr_log(GPR_INFO, "[RR %p] received update with address error: %s", this,
|
@@ -710,8 +709,8 @@ absl::Status RoundRobin::UpdateLocked(UpdateArgs args) {
|
|
710
709
|
latest_pending_endpoint_list_.get());
|
711
710
|
}
|
712
711
|
latest_pending_endpoint_list_ = MakeOrphanable<RoundRobinEndpointList>(
|
713
|
-
|
714
|
-
args.args);
|
712
|
+
RefAsSubclass<RoundRobin>(DEBUG_LOCATION, "RoundRobinEndpointList"),
|
713
|
+
addresses, args.args);
|
715
714
|
// If the new list is empty, immediately promote it to
|
716
715
|
// endpoint_list_ and report TRANSIENT_FAILURE.
|
717
716
|
if (latest_pending_endpoint_list_->size() == 0) {
|
@@ -748,15 +747,13 @@ void RoundRobin::RoundRobinEndpointList::RoundRobinEndpoint::OnStateUpdate(
|
|
748
747
|
auto* rr_endpoint_list = endpoint_list<RoundRobinEndpointList>();
|
749
748
|
auto* round_robin = policy<RoundRobin>();
|
750
749
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
751
|
-
gpr_log(
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
(old_state.has_value() ? ConnectivityStateName(*old_state) : "N/A"),
|
759
|
-
ConnectivityStateName(new_state), status.ToString().c_str());
|
750
|
+
gpr_log(
|
751
|
+
GPR_INFO,
|
752
|
+
"[RR %p] connectivity changed for child %p, endpoint_list %p "
|
753
|
+
"(index %" PRIuPTR " of %" PRIuPTR "): prev_state=%s new_state=%s (%s)",
|
754
|
+
round_robin, this, rr_endpoint_list, Index(), rr_endpoint_list->size(),
|
755
|
+
(old_state.has_value() ? ConnectivityStateName(*old_state) : "N/A"),
|
756
|
+
ConnectivityStateName(new_state), status.ToString().c_str());
|
760
757
|
}
|
761
758
|
if (new_state == GRPC_CHANNEL_IDLE) {
|
762
759
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
|
@@ -42,6 +42,7 @@
|
|
42
42
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
43
43
|
#include "src/core/lib/load_balancing/lb_policy.h"
|
44
44
|
#include "src/core/lib/load_balancing/subchannel_interface.h"
|
45
|
+
#include "src/core/lib/resolver/endpoint_addresses.h"
|
45
46
|
#include "src/core/lib/resolver/server_address.h"
|
46
47
|
#include "src/core/lib/transport/connectivity_state.h"
|
47
48
|
|
@@ -208,7 +209,7 @@ class SubchannelList : public DualRefCounted<SubchannelListType> {
|
|
208
209
|
|
209
210
|
protected:
|
210
211
|
SubchannelList(LoadBalancingPolicy* policy, const char* tracer,
|
211
|
-
|
212
|
+
EndpointAddressesIterator* addresses,
|
212
213
|
LoadBalancingPolicy::ChannelControlHelper* helper,
|
213
214
|
const ChannelArgs& args);
|
214
215
|
|
@@ -365,19 +366,18 @@ void SubchannelData<SubchannelListType, SubchannelDataType>::ShutdownLocked() {
|
|
365
366
|
template <typename SubchannelListType, typename SubchannelDataType>
|
366
367
|
SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
|
367
368
|
LoadBalancingPolicy* policy, const char* tracer,
|
368
|
-
|
369
|
+
EndpointAddressesIterator* addresses,
|
369
370
|
LoadBalancingPolicy::ChannelControlHelper* helper, const ChannelArgs& args)
|
370
371
|
: DualRefCounted<SubchannelListType>(tracer),
|
371
372
|
policy_(policy),
|
372
373
|
tracer_(tracer) {
|
373
374
|
if (GPR_UNLIKELY(tracer_ != nullptr)) {
|
374
|
-
gpr_log(GPR_INFO,
|
375
|
-
|
376
|
-
tracer_, policy, this, addresses.size());
|
375
|
+
gpr_log(GPR_INFO, "[%s %p] Creating subchannel list %p", tracer_, policy,
|
376
|
+
this);
|
377
377
|
}
|
378
|
-
|
378
|
+
if (addresses == nullptr) return;
|
379
379
|
// Create a subchannel for each address.
|
380
|
-
|
380
|
+
addresses->ForEach([&](const EndpointAddresses& address) {
|
381
381
|
RefCountedPtr<SubchannelInterface> subchannel =
|
382
382
|
helper->CreateSubchannel(address.address(), address.args(), args);
|
383
383
|
if (subchannel == nullptr) {
|
@@ -387,7 +387,7 @@ SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
|
|
387
387
|
"[%s %p] could not create subchannel for address %s, ignoring",
|
388
388
|
tracer_, policy_, address.ToString().c_str());
|
389
389
|
}
|
390
|
-
|
390
|
+
return;
|
391
391
|
}
|
392
392
|
if (GPR_UNLIKELY(tracer_ != nullptr)) {
|
393
393
|
gpr_log(GPR_INFO,
|
@@ -397,8 +397,8 @@ SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
|
|
397
397
|
address.ToString().c_str());
|
398
398
|
}
|
399
399
|
subchannels_.emplace_back();
|
400
|
-
subchannels_.back().Init(this,
|
401
|
-
}
|
400
|
+
subchannels_.back().Init(this, address, std::move(subchannel));
|
401
|
+
});
|
402
402
|
}
|
403
403
|
|
404
404
|
template <typename SubchannelListType, typename SubchannelDataType>
|
data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc
CHANGED
@@ -247,14 +247,13 @@ class OldWeightedRoundRobin : public LoadBalancingPolicy {
|
|
247
247
|
WeightedRoundRobinSubchannelData> {
|
248
248
|
public:
|
249
249
|
WeightedRoundRobinSubchannelList(OldWeightedRoundRobin* policy,
|
250
|
-
|
250
|
+
EndpointAddressesIterator* addresses,
|
251
251
|
const ChannelArgs& args)
|
252
252
|
: SubchannelList(policy,
|
253
253
|
(GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)
|
254
254
|
? "WeightedRoundRobinSubchannelList"
|
255
255
|
: nullptr),
|
256
|
-
|
257
|
-
args) {
|
256
|
+
addresses, policy->channel_control_helper(), args) {
|
258
257
|
// Need to maintain a ref to the LB policy as long as we maintain
|
259
258
|
// any references to subchannels, since the subchannels'
|
260
259
|
// pollset_sets will include the LB policy's pollset_set.
|
@@ -611,10 +610,9 @@ void OldWeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
|
611
610
|
scheduler_ = std::move(scheduler);
|
612
611
|
}
|
613
612
|
// Start timer.
|
614
|
-
WeakRefCountedPtr<Picker> self = WeakRef();
|
615
613
|
timer_handle_ = wrr_->channel_control_helper()->GetEventEngine()->RunAfter(
|
616
614
|
config_->weight_update_period(),
|
617
|
-
[self =
|
615
|
+
[self = WeakRefAsSubclass<Picker>(),
|
618
616
|
work_serializer = wrr_->work_serializer()]() mutable {
|
619
617
|
ApplicationCallbackExecCtx callback_exec_ctx;
|
620
618
|
ExecCtx exec_ctx;
|
@@ -674,12 +672,11 @@ void OldWeightedRoundRobin::ResetBackoffLocked() {
|
|
674
672
|
|
675
673
|
absl::Status OldWeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
676
674
|
global_stats().IncrementWrrUpdates();
|
677
|
-
config_ =
|
678
|
-
|
675
|
+
config_ = args.config.TakeAsSubclass<WeightedRoundRobinConfig>();
|
676
|
+
std::shared_ptr<EndpointAddressesIterator> addresses;
|
679
677
|
if (args.addresses.ok()) {
|
680
678
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
681
|
-
gpr_log(GPR_INFO, "[WRR %p] received update
|
682
|
-
this, args.addresses->size());
|
679
|
+
gpr_log(GPR_INFO, "[WRR %p] received update", this);
|
683
680
|
}
|
684
681
|
// Weed out duplicate addresses. Also sort the addresses so that if
|
685
682
|
// the set of the addresses don't change, their indexes in the
|
@@ -698,10 +695,12 @@ absl::Status OldWeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
|
698
695
|
return memcmp(addr1.addr, addr2.addr, addr1.len) < 0;
|
699
696
|
}
|
700
697
|
};
|
701
|
-
std::set<ServerAddress, AddressLessThan> ordered_addresses
|
702
|
-
|
703
|
-
|
704
|
-
|
698
|
+
std::set<ServerAddress, AddressLessThan> ordered_addresses;
|
699
|
+
(*args.addresses)->ForEach([&](const EndpointAddresses& endpoint) {
|
700
|
+
ordered_addresses.insert(endpoint);
|
701
|
+
});
|
702
|
+
addresses = std::make_shared<EndpointAddressesListIterator>(
|
703
|
+
ServerAddressList(ordered_addresses.begin(), ordered_addresses.end()));
|
705
704
|
} else {
|
706
705
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
707
706
|
gpr_log(GPR_INFO, "[WRR %p] received update with address error: %s", this,
|
@@ -718,8 +717,8 @@ absl::Status OldWeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
|
718
717
|
this, latest_pending_subchannel_list_.get());
|
719
718
|
}
|
720
719
|
latest_pending_subchannel_list_ =
|
721
|
-
MakeRefCounted<WeightedRoundRobinSubchannelList>(
|
722
|
-
|
720
|
+
MakeRefCounted<WeightedRoundRobinSubchannelList>(this, addresses.get(),
|
721
|
+
args.args);
|
723
722
|
latest_pending_subchannel_list_->StartWatchingLocked(args.args);
|
724
723
|
// If the new list is empty, immediately promote it to
|
725
724
|
// subchannel_list_ and report TRANSIENT_FAILURE.
|
@@ -757,8 +756,9 @@ OldWeightedRoundRobin::GetOrCreateWeight(const grpc_resolved_address& address) {
|
|
757
756
|
auto weight = it->second->RefIfNonZero();
|
758
757
|
if (weight != nullptr) return weight;
|
759
758
|
}
|
760
|
-
auto weight =
|
761
|
-
|
759
|
+
auto weight = MakeRefCounted<AddressWeight>(
|
760
|
+
RefAsSubclass<OldWeightedRoundRobin>(DEBUG_LOCATION, "AddressWeight"),
|
761
|
+
*key);
|
762
762
|
address_weight_map_.emplace(*key, weight.get());
|
763
763
|
return weight;
|
764
764
|
}
|
@@ -833,7 +833,8 @@ void OldWeightedRoundRobin::WeightedRoundRobinSubchannelList::
|
|
833
833
|
}
|
834
834
|
p->channel_control_helper()->UpdateState(
|
835
835
|
GRPC_CHANNEL_READY, absl::Status(),
|
836
|
-
MakeRefCounted<Picker>(p->
|
836
|
+
MakeRefCounted<Picker>(p->RefAsSubclass<OldWeightedRoundRobin>(),
|
837
|
+
this));
|
837
838
|
} else if (num_connecting_ > 0) {
|
838
839
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
839
840
|
gpr_log(GPR_INFO, "[WRR %p] reporting CONNECTING with subchannel list %p",
|
@@ -1038,7 +1039,7 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
1038
1039
|
public:
|
1039
1040
|
class WrrEndpoint : public Endpoint {
|
1040
1041
|
public:
|
1041
|
-
WrrEndpoint(RefCountedPtr<
|
1042
|
+
WrrEndpoint(RefCountedPtr<EndpointList> endpoint_list,
|
1042
1043
|
const EndpointAddresses& addresses, const ChannelArgs& args,
|
1043
1044
|
std::shared_ptr<WorkSerializer> work_serializer)
|
1044
1045
|
: Endpoint(std::move(endpoint_list)),
|
@@ -1079,14 +1080,14 @@ class WeightedRoundRobin : public LoadBalancingPolicy {
|
|
1079
1080
|
};
|
1080
1081
|
|
1081
1082
|
WrrEndpointList(RefCountedPtr<WeightedRoundRobin> wrr,
|
1082
|
-
|
1083
|
+
EndpointAddressesIterator* endpoints,
|
1083
1084
|
const ChannelArgs& args)
|
1084
1085
|
: EndpointList(std::move(wrr),
|
1085
1086
|
GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)
|
1086
1087
|
? "WrrEndpointList"
|
1087
1088
|
: nullptr) {
|
1088
1089
|
Init(endpoints, args,
|
1089
|
-
[&](RefCountedPtr<
|
1090
|
+
[&](RefCountedPtr<EndpointList> endpoint_list,
|
1090
1091
|
const EndpointAddresses& addresses, const ChannelArgs& args) {
|
1091
1092
|
return MakeOrphanable<WrrEndpoint>(
|
1092
1093
|
std::move(endpoint_list), addresses, args,
|
@@ -1452,10 +1453,9 @@ void WeightedRoundRobin::Picker::BuildSchedulerAndStartTimerLocked() {
|
|
1452
1453
|
gpr_log(GPR_INFO, "[WRR %p picker %p] scheduling timer for %s", wrr_.get(),
|
1453
1454
|
this, config_->weight_update_period().ToString().c_str());
|
1454
1455
|
}
|
1455
|
-
WeakRefCountedPtr<Picker> self = WeakRef();
|
1456
1456
|
timer_handle_ = wrr_->channel_control_helper()->GetEventEngine()->RunAfter(
|
1457
1457
|
config_->weight_update_period(),
|
1458
|
-
[self =
|
1458
|
+
[self = WeakRefAsSubclass<Picker>(),
|
1459
1459
|
work_serializer = wrr_->work_serializer()]() mutable {
|
1460
1460
|
ApplicationCallbackExecCtx callback_exec_ctx;
|
1461
1461
|
ExecCtx exec_ctx;
|
@@ -1515,12 +1515,11 @@ void WeightedRoundRobin::ResetBackoffLocked() {
|
|
1515
1515
|
|
1516
1516
|
absl::Status WeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
1517
1517
|
global_stats().IncrementWrrUpdates();
|
1518
|
-
config_ =
|
1519
|
-
|
1518
|
+
config_ = args.config.TakeAsSubclass<WeightedRoundRobinConfig>();
|
1519
|
+
std::shared_ptr<EndpointAddressesIterator> addresses;
|
1520
1520
|
if (args.addresses.ok()) {
|
1521
1521
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1522
|
-
gpr_log(GPR_INFO, "[WRR %p] received update
|
1523
|
-
this, args.addresses->size());
|
1522
|
+
gpr_log(GPR_INFO, "[WRR %p] received update", this);
|
1524
1523
|
}
|
1525
1524
|
// Weed out duplicate endpoints. Also sort the endpoints so that if
|
1526
1525
|
// the set of endpoints doesn't change, their indexes in the endpoint
|
@@ -1539,10 +1538,13 @@ absl::Status WeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
|
1539
1538
|
return e1 < e2;
|
1540
1539
|
}
|
1541
1540
|
};
|
1542
|
-
std::set<EndpointAddresses, EndpointAddressesLessThan> ordered_addresses
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1541
|
+
std::set<EndpointAddresses, EndpointAddressesLessThan> ordered_addresses;
|
1542
|
+
(*args.addresses)->ForEach([&](const EndpointAddresses& endpoint) {
|
1543
|
+
ordered_addresses.insert(endpoint);
|
1544
|
+
});
|
1545
|
+
addresses =
|
1546
|
+
std::make_shared<EndpointAddressesListIterator>(EndpointAddressesList(
|
1547
|
+
ordered_addresses.begin(), ordered_addresses.end()));
|
1546
1548
|
} else {
|
1547
1549
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1548
1550
|
gpr_log(GPR_INFO, "[WRR %p] received update with address error: %s", this,
|
@@ -1558,8 +1560,8 @@ absl::Status WeightedRoundRobin::UpdateLocked(UpdateArgs args) {
|
|
1558
1560
|
gpr_log(GPR_INFO, "[WRR %p] replacing previous pending endpoint list %p",
|
1559
1561
|
this, latest_pending_endpoint_list_.get());
|
1560
1562
|
}
|
1561
|
-
latest_pending_endpoint_list_ =
|
1562
|
-
|
1563
|
+
latest_pending_endpoint_list_ = MakeOrphanable<WrrEndpointList>(
|
1564
|
+
RefAsSubclass<WeightedRoundRobin>(), addresses.get(), args.args);
|
1563
1565
|
// If the new list is empty, immediately promote it to
|
1564
1566
|
// endpoint_list_ and report TRANSIENT_FAILURE.
|
1565
1567
|
if (latest_pending_endpoint_list_->size() == 0) {
|
@@ -1597,7 +1599,7 @@ WeightedRoundRobin::GetOrCreateWeight(
|
|
1597
1599
|
if (weight != nullptr) return weight;
|
1598
1600
|
}
|
1599
1601
|
auto weight = MakeRefCounted<EndpointWeight>(
|
1600
|
-
|
1602
|
+
RefAsSubclass<WeightedRoundRobin>(DEBUG_LOCATION, "EndpointWeight"), key);
|
1601
1603
|
endpoint_weight_map_.emplace(key, weight.get());
|
1602
1604
|
return weight;
|
1603
1605
|
}
|
@@ -1757,7 +1759,7 @@ void WeightedRoundRobin::WrrEndpointList::
|
|
1757
1759
|
}
|
1758
1760
|
wrr->channel_control_helper()->UpdateState(
|
1759
1761
|
GRPC_CHANNEL_READY, absl::Status(),
|
1760
|
-
MakeRefCounted<Picker>(wrr->
|
1762
|
+
MakeRefCounted<Picker>(wrr->RefAsSubclass<WeightedRoundRobin>(), this));
|
1761
1763
|
} else if (num_connecting_ > 0) {
|
1762
1764
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_wrr_trace)) {
|
1763
1765
|
gpr_log(GPR_INFO, "[WRR %p] reporting CONNECTING with endpoint list %p",
|
@@ -157,10 +157,10 @@ class WeightedTargetLb : public LoadBalancingPolicy {
|
|
157
157
|
|
158
158
|
void Orphan() override;
|
159
159
|
|
160
|
-
absl::Status UpdateLocked(
|
161
|
-
|
162
|
-
|
163
|
-
|
160
|
+
absl::Status UpdateLocked(
|
161
|
+
const WeightedTargetLbConfig::ChildConfig& config,
|
162
|
+
absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>> addresses,
|
163
|
+
const std::string& resolution_note, const ChannelArgs& args);
|
164
164
|
void ResetBackoffLocked();
|
165
165
|
void DeactivateLocked();
|
166
166
|
|
@@ -316,7 +316,7 @@ absl::Status WeightedTargetLb::UpdateLocked(UpdateArgs args) {
|
|
316
316
|
}
|
317
317
|
update_in_progress_ = true;
|
318
318
|
// Update config.
|
319
|
-
config_ =
|
319
|
+
config_ = args.config.TakeAsSubclass<WeightedTargetLbConfig>();
|
320
320
|
// Deactivate the targets not in the new config.
|
321
321
|
for (const auto& p : targets_) {
|
322
322
|
const std::string& name = p.first;
|
@@ -336,13 +336,15 @@ absl::Status WeightedTargetLb::UpdateLocked(UpdateArgs args) {
|
|
336
336
|
// Create child if it does not already exist.
|
337
337
|
if (target == nullptr) {
|
338
338
|
target = MakeOrphanable<WeightedChild>(
|
339
|
-
|
339
|
+
RefAsSubclass<WeightedTargetLb>(DEBUG_LOCATION, "WeightedChild"),
|
340
|
+
name);
|
340
341
|
}
|
341
|
-
absl::StatusOr<
|
342
|
+
absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>> addresses;
|
342
343
|
if (address_map.ok()) {
|
343
344
|
auto it = address_map->find(name);
|
344
345
|
if (it == address_map->end()) {
|
345
|
-
addresses
|
346
|
+
addresses = std::make_shared<EndpointAddressesListIterator>(
|
347
|
+
EndpointAddressesList());
|
346
348
|
} else {
|
347
349
|
addresses = std::move(it->second);
|
348
350
|
}
|
@@ -589,7 +591,7 @@ WeightedTargetLb::WeightedChild::CreateChildPolicyLocked(
|
|
589
591
|
|
590
592
|
absl::Status WeightedTargetLb::WeightedChild::UpdateLocked(
|
591
593
|
const WeightedTargetLbConfig::ChildConfig& config,
|
592
|
-
absl::StatusOr<
|
594
|
+
absl::StatusOr<std::shared_ptr<EndpointAddressesIterator>> addresses,
|
593
595
|
const std::string& resolution_note, const ChannelArgs& args) {
|
594
596
|
if (weighted_target_policy_->shutting_down_) return absl::OkStatus();
|
595
597
|
// Update child weight.
|