grpc 1.49.0.pre1 → 1.50.0.pre1
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 +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +19 -16
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +31 -17
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
@@ -36,34 +36,31 @@
|
|
36
36
|
#include "absl/random/random.h"
|
37
37
|
#include "absl/status/status.h"
|
38
38
|
#include "absl/status/statusor.h"
|
39
|
-
#include "absl/strings/str_cat.h"
|
40
|
-
#include "absl/strings/str_join.h"
|
41
39
|
#include "absl/strings/string_view.h"
|
42
40
|
#include "absl/types/variant.h"
|
43
41
|
|
44
42
|
#include <grpc/impl/codegen/connectivity_state.h>
|
45
|
-
#include <grpc/support/alloc.h>
|
46
43
|
#include <grpc/support/log.h>
|
47
44
|
|
48
45
|
#include "src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h"
|
49
46
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
50
47
|
#include "src/core/lib/channel/channel_args.h"
|
48
|
+
#include "src/core/lib/config/core_configuration.h"
|
51
49
|
#include "src/core/lib/debug/trace.h"
|
52
|
-
#include "src/core/lib/gpr/env.h"
|
53
50
|
#include "src/core/lib/gpr/string.h"
|
54
51
|
#include "src/core/lib/gprpp/debug_location.h"
|
52
|
+
#include "src/core/lib/gprpp/env.h"
|
55
53
|
#include "src/core/lib/gprpp/orphanable.h"
|
56
54
|
#include "src/core/lib/gprpp/ref_counted.h"
|
57
55
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
56
|
+
#include "src/core/lib/gprpp/validation_errors.h"
|
58
57
|
#include "src/core/lib/gprpp/work_serializer.h"
|
59
58
|
#include "src/core/lib/iomgr/closure.h"
|
60
59
|
#include "src/core/lib/iomgr/error.h"
|
61
|
-
#include "src/core/lib/iomgr/exec_ctx.h"
|
62
60
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
63
61
|
#include "src/core/lib/iomgr/pollset_set.h"
|
64
62
|
#include "src/core/lib/iomgr/timer.h"
|
65
63
|
#include "src/core/lib/json/json.h"
|
66
|
-
#include "src/core/lib/json/json_util.h"
|
67
64
|
#include "src/core/lib/load_balancing/lb_policy.h"
|
68
65
|
#include "src/core/lib/load_balancing/lb_policy_factory.h"
|
69
66
|
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
@@ -77,10 +74,10 @@ TraceFlag grpc_outlier_detection_lb_trace(false, "outlier_detection_lb");
|
|
77
74
|
|
78
75
|
// TODO(donnadionne): Remove once outlier detection is no longer experimental
|
79
76
|
bool XdsOutlierDetectionEnabled() {
|
80
|
-
|
77
|
+
auto value = GetEnv("GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION");
|
78
|
+
if (!value.has_value()) return false;
|
81
79
|
bool parsed_value;
|
82
|
-
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
83
|
-
gpr_free(value);
|
80
|
+
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
84
81
|
return parse_succeeded && parsed_value;
|
85
82
|
}
|
86
83
|
|
@@ -125,7 +122,7 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
|
|
125
122
|
|
126
123
|
absl::string_view name() const override { return kOutlierDetection; }
|
127
124
|
|
128
|
-
|
125
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
129
126
|
void ExitIdleLocked() override;
|
130
127
|
void ResetBackoffLocked() override;
|
131
128
|
|
@@ -296,7 +293,7 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
|
|
296
293
|
base_ejection_time_in_millis * multiplier_,
|
297
294
|
std::max(base_ejection_time_in_millis,
|
298
295
|
max_ejection_time_in_millis)));
|
299
|
-
if (change_time <
|
296
|
+
if (change_time < Timestamp::Now()) {
|
300
297
|
Uneject();
|
301
298
|
return true;
|
302
299
|
}
|
@@ -594,7 +591,7 @@ void OutlierDetectionLb::ResetBackoffLocked() {
|
|
594
591
|
if (child_policy_ != nullptr) child_policy_->ResetBackoffLocked();
|
595
592
|
}
|
596
593
|
|
597
|
-
|
594
|
+
absl::Status OutlierDetectionLb::UpdateLocked(UpdateArgs args) {
|
598
595
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_outlier_detection_lb_trace)) {
|
599
596
|
gpr_log(GPR_INFO, "[outlier_detection_lb %p] Received update", this);
|
600
597
|
}
|
@@ -615,8 +612,7 @@ void OutlierDetectionLb::UpdateLocked(UpdateArgs args) {
|
|
615
612
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_outlier_detection_lb_trace)) {
|
616
613
|
gpr_log(GPR_INFO, "[outlier_detection_lb %p] starting timer", this);
|
617
614
|
}
|
618
|
-
ejection_timer_ =
|
619
|
-
MakeOrphanable<EjectionTimer>(Ref(), ExecCtx::Get()->Now());
|
615
|
+
ejection_timer_ = MakeOrphanable<EjectionTimer>(Ref(), Timestamp::Now());
|
620
616
|
for (const auto& p : subchannel_state_map_) {
|
621
617
|
p.second->RotateBucket(); // Reset call counters.
|
622
618
|
}
|
@@ -649,6 +645,12 @@ void OutlierDetectionLb::UpdateLocked(UpdateArgs args) {
|
|
649
645
|
}
|
650
646
|
} else if (!config_->CountingEnabled()) {
|
651
647
|
// If counting is not enabled, reset state.
|
648
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_outlier_detection_lb_trace)) {
|
649
|
+
gpr_log(GPR_INFO,
|
650
|
+
"[outlier_detection_lb %p] counting disabled; disabling "
|
651
|
+
"ejection for %s (%p)",
|
652
|
+
this, address_key.c_str(), subchannel_state.get());
|
653
|
+
}
|
652
654
|
subchannel_state->DisableEjection();
|
653
655
|
}
|
654
656
|
current_addresses.emplace(address_key);
|
@@ -685,7 +687,7 @@ void OutlierDetectionLb::UpdateLocked(UpdateArgs args) {
|
|
685
687
|
"[outlier_detection_lb %p] Updating child policy handler %p", this,
|
686
688
|
child_policy_.get());
|
687
689
|
}
|
688
|
-
child_policy_->UpdateLocked(std::move(update_args));
|
690
|
+
return child_policy_->UpdateLocked(std::move(update_args));
|
689
691
|
}
|
690
692
|
|
691
693
|
void OutlierDetectionLb::MaybeUpdatePickerLocked() {
|
@@ -829,7 +831,7 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked(grpc_error_handle error) {
|
|
829
831
|
std::map<SubchannelState*, double> failure_percentage_ejection_candidates;
|
830
832
|
size_t ejected_host_count = 0;
|
831
833
|
double success_rate_sum = 0;
|
832
|
-
auto time_now =
|
834
|
+
auto time_now = Timestamp::Now();
|
833
835
|
auto& config = parent_->config_->outlier_detection_config();
|
834
836
|
for (auto& state : parent_->subchannel_state_map_) {
|
835
837
|
auto* subchannel_state = state.second.get();
|
@@ -1000,7 +1002,7 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked(grpc_error_handle error) {
|
|
1000
1002
|
}
|
1001
1003
|
timer_pending_ = false;
|
1002
1004
|
parent_->ejection_timer_ =
|
1003
|
-
MakeOrphanable<EjectionTimer>(parent_,
|
1005
|
+
MakeOrphanable<EjectionTimer>(parent_, Timestamp::Now());
|
1004
1006
|
}
|
1005
1007
|
Unref(DEBUG_LOCATION, "Timer");
|
1006
1008
|
GRPC_ERROR_UNREF(error);
|
@@ -1029,94 +1031,35 @@ class OutlierDetectionLbFactory : public LoadBalancingPolicyFactory {
|
|
1029
1031
|
"configuration. Please use loadBalancingConfig field of service "
|
1030
1032
|
"config instead.");
|
1031
1033
|
}
|
1032
|
-
|
1033
|
-
std::vector<grpc_error_handle> error_list;
|
1034
|
-
// Outlier detection config
|
1034
|
+
ValidationErrors errors;
|
1035
1035
|
OutlierDetectionConfig outlier_detection_config;
|
1036
|
-
auto it = json.object_value().find("successRateEjection");
|
1037
|
-
if (it != json.object_value().end()) {
|
1038
|
-
if (it->second.type() != Json::Type::OBJECT) {
|
1039
|
-
errors.emplace_back(
|
1040
|
-
"field:successRateEjection error:type must be object");
|
1041
|
-
} else {
|
1042
|
-
OutlierDetectionConfig::SuccessRateEjection success_config;
|
1043
|
-
const Json::Object& object = it->second.object_value();
|
1044
|
-
ParseJsonObjectField(object, "stdevFactor",
|
1045
|
-
&success_config.stdev_factor, &error_list,
|
1046
|
-
/*required=*/false);
|
1047
|
-
ParseJsonObjectField(object, "enforcementPercentage",
|
1048
|
-
&success_config.enforcement_percentage,
|
1049
|
-
&error_list, /*required=*/false);
|
1050
|
-
ParseJsonObjectField(object, "minimumHosts",
|
1051
|
-
&success_config.minimum_hosts, &error_list,
|
1052
|
-
/*required=*/false);
|
1053
|
-
ParseJsonObjectField(object, "requestVolume",
|
1054
|
-
&success_config.request_volume, &error_list,
|
1055
|
-
/*required=*/false);
|
1056
|
-
outlier_detection_config.success_rate_ejection = success_config;
|
1057
|
-
}
|
1058
|
-
}
|
1059
|
-
it = json.object_value().find("failurePercentageEjection");
|
1060
|
-
if (it != json.object_value().end()) {
|
1061
|
-
if (it->second.type() != Json::Type::OBJECT) {
|
1062
|
-
errors.emplace_back(
|
1063
|
-
"field:successRateEjection error:type must be object");
|
1064
|
-
} else {
|
1065
|
-
OutlierDetectionConfig::FailurePercentageEjection failure_config;
|
1066
|
-
const Json::Object& object = it->second.object_value();
|
1067
|
-
ParseJsonObjectField(object, "threshold", &failure_config.threshold,
|
1068
|
-
&error_list, /*required=*/false);
|
1069
|
-
ParseJsonObjectField(object, "enforcementPercentage",
|
1070
|
-
&failure_config.enforcement_percentage,
|
1071
|
-
&error_list, /*required=*/false);
|
1072
|
-
ParseJsonObjectField(object, "minimumHosts",
|
1073
|
-
&failure_config.minimum_hosts, &error_list,
|
1074
|
-
/*required=*/false);
|
1075
|
-
ParseJsonObjectField(object, "requestVolume",
|
1076
|
-
&failure_config.request_volume, &error_list,
|
1077
|
-
/*required=*/false);
|
1078
|
-
outlier_detection_config.failure_percentage_ejection = failure_config;
|
1079
|
-
}
|
1080
|
-
}
|
1081
|
-
ParseJsonObjectFieldAsDuration(json.object_value(), "interval",
|
1082
|
-
&outlier_detection_config.interval,
|
1083
|
-
&error_list, /*required=*/false);
|
1084
|
-
ParseJsonObjectFieldAsDuration(json.object_value(), "baseEjectionTime",
|
1085
|
-
&outlier_detection_config.base_ejection_time,
|
1086
|
-
&error_list, /*required=*/false);
|
1087
|
-
if (!ParseJsonObjectFieldAsDuration(
|
1088
|
-
json.object_value(), "maxEjectionTime",
|
1089
|
-
&outlier_detection_config.max_ejection_time, &error_list,
|
1090
|
-
/*required=*/false)) {
|
1091
|
-
outlier_detection_config.max_ejection_time = std::max(
|
1092
|
-
outlier_detection_config.base_ejection_time, Duration::Seconds(300));
|
1093
|
-
}
|
1094
|
-
ParseJsonObjectField(json.object_value(), "maxEjectionPercent",
|
1095
|
-
&outlier_detection_config.max_ejection_percent,
|
1096
|
-
&error_list, /*required=*/false);
|
1097
1036
|
RefCountedPtr<LoadBalancingPolicy::Config> child_policy;
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
errors.
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1037
|
+
{
|
1038
|
+
ValidationErrors::ScopedField field(
|
1039
|
+
&errors, "[\"outlier_detection_experimental\"]");
|
1040
|
+
outlier_detection_config =
|
1041
|
+
LoadFromJson<OutlierDetectionConfig>(json, JsonArgs(), &errors);
|
1042
|
+
// Parse childPolicy manually.
|
1043
|
+
{
|
1044
|
+
ValidationErrors::ScopedField field(&errors, ".childPolicy");
|
1045
|
+
auto it = json.object_value().find("childPolicy");
|
1046
|
+
if (it == json.object_value().end()) {
|
1047
|
+
errors.AddError("field not present");
|
1048
|
+
} else {
|
1049
|
+
auto child_policy_config = CoreConfiguration::Get()
|
1050
|
+
.lb_policy_registry()
|
1051
|
+
.ParseLoadBalancingConfig(it->second);
|
1052
|
+
if (!child_policy_config.ok()) {
|
1053
|
+
errors.AddError(child_policy_config.status().message());
|
1054
|
+
} else {
|
1055
|
+
child_policy = std::move(*child_policy_config);
|
1056
|
+
}
|
1057
|
+
}
|
1110
1058
|
}
|
1111
1059
|
}
|
1112
|
-
|
1113
|
-
errors.
|
1114
|
-
|
1115
|
-
}
|
1116
|
-
if (!errors.empty()) {
|
1117
|
-
return absl::InvalidArgumentError(
|
1118
|
-
absl::StrCat("outlier_detection_experimental LB policy config: [",
|
1119
|
-
absl::StrJoin(errors, "; "), "]"));
|
1060
|
+
if (!errors.ok()) {
|
1061
|
+
return errors.status(
|
1062
|
+
"errors validating outlier_detection LB policy config");
|
1120
1063
|
}
|
1121
1064
|
return MakeRefCounted<OutlierDetectionLbConfig>(outlier_detection_config,
|
1122
1065
|
std::move(child_policy));
|
@@ -1125,18 +1068,73 @@ class OutlierDetectionLbFactory : public LoadBalancingPolicyFactory {
|
|
1125
1068
|
|
1126
1069
|
} // namespace
|
1127
1070
|
|
1128
|
-
|
1071
|
+
//
|
1072
|
+
// OutlierDetectionConfig
|
1073
|
+
//
|
1074
|
+
|
1075
|
+
const JsonLoaderInterface*
|
1076
|
+
OutlierDetectionConfig::SuccessRateEjection::JsonLoader(const JsonArgs&) {
|
1077
|
+
static const auto* loader =
|
1078
|
+
JsonObjectLoader<SuccessRateEjection>()
|
1079
|
+
.OptionalField("stdevFactor", &SuccessRateEjection::stdev_factor)
|
1080
|
+
.OptionalField("enforcementPercentage",
|
1081
|
+
&SuccessRateEjection::enforcement_percentage)
|
1082
|
+
.OptionalField("minimumHosts", &SuccessRateEjection::minimum_hosts)
|
1083
|
+
.OptionalField("requestVolume", &SuccessRateEjection::request_volume)
|
1084
|
+
.Finish();
|
1085
|
+
return loader;
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
const JsonLoaderInterface*
|
1089
|
+
OutlierDetectionConfig::FailurePercentageEjection::JsonLoader(const JsonArgs&) {
|
1090
|
+
static const auto* loader =
|
1091
|
+
JsonObjectLoader<FailurePercentageEjection>()
|
1092
|
+
.OptionalField("threshold", &FailurePercentageEjection::threshold)
|
1093
|
+
.OptionalField("enforcementPercentage",
|
1094
|
+
&FailurePercentageEjection::enforcement_percentage)
|
1095
|
+
.OptionalField("minimumHosts",
|
1096
|
+
&FailurePercentageEjection::minimum_hosts)
|
1097
|
+
.OptionalField("requestVolume",
|
1098
|
+
&FailurePercentageEjection::request_volume)
|
1099
|
+
.Finish();
|
1100
|
+
return loader;
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
const JsonLoaderInterface* OutlierDetectionConfig::JsonLoader(const JsonArgs&) {
|
1104
|
+
static const auto* loader =
|
1105
|
+
JsonObjectLoader<OutlierDetectionConfig>()
|
1106
|
+
.OptionalField("interval", &OutlierDetectionConfig::interval)
|
1107
|
+
.OptionalField("baseEjectionTime",
|
1108
|
+
&OutlierDetectionConfig::base_ejection_time)
|
1109
|
+
.OptionalField("maxEjectionTime",
|
1110
|
+
&OutlierDetectionConfig::max_ejection_time)
|
1111
|
+
.OptionalField("maxEjectionPercent",
|
1112
|
+
&OutlierDetectionConfig::max_ejection_percent)
|
1113
|
+
.OptionalField("successRateEjection",
|
1114
|
+
&OutlierDetectionConfig::success_rate_ejection)
|
1115
|
+
.OptionalField("failurePercentageEjection",
|
1116
|
+
&OutlierDetectionConfig::failure_percentage_ejection)
|
1117
|
+
.Finish();
|
1118
|
+
return loader;
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
void OutlierDetectionConfig::JsonPostLoad(const Json& json, const JsonArgs&,
|
1122
|
+
ValidationErrors* /*errors*/) {
|
1123
|
+
if (json.object_value().find("maxEjectionTime") ==
|
1124
|
+
json.object_value().end()) {
|
1125
|
+
max_ejection_time = std::max(base_ejection_time, Duration::Seconds(300));
|
1126
|
+
}
|
1127
|
+
}
|
1129
1128
|
|
1130
1129
|
//
|
1131
1130
|
// Plugin registration
|
1132
1131
|
//
|
1133
1132
|
|
1134
|
-
void
|
1135
|
-
if (
|
1136
|
-
|
1137
|
-
|
1138
|
-
absl::make_unique<grpc_core::OutlierDetectionLbFactory>());
|
1133
|
+
void RegisterOutlierDetectionLbPolicy(CoreConfiguration::Builder* builder) {
|
1134
|
+
if (XdsOutlierDetectionEnabled()) {
|
1135
|
+
builder->lb_policy_registry()->RegisterLoadBalancingPolicyFactory(
|
1136
|
+
absl::make_unique<OutlierDetectionLbFactory>());
|
1139
1137
|
}
|
1140
1138
|
}
|
1141
1139
|
|
1142
|
-
|
1140
|
+
} // namespace grpc_core
|
@@ -24,6 +24,10 @@
|
|
24
24
|
#include "absl/types/optional.h"
|
25
25
|
|
26
26
|
#include "src/core/lib/gprpp/time.h"
|
27
|
+
#include "src/core/lib/gprpp/validation_errors.h"
|
28
|
+
#include "src/core/lib/json/json.h"
|
29
|
+
#include "src/core/lib/json/json_args.h"
|
30
|
+
#include "src/core/lib/json/json_object_loader.h"
|
27
31
|
|
28
32
|
namespace grpc_core {
|
29
33
|
|
@@ -40,12 +44,16 @@ struct OutlierDetectionConfig {
|
|
40
44
|
uint32_t minimum_hosts = 5;
|
41
45
|
uint32_t request_volume = 100;
|
42
46
|
|
47
|
+
SuccessRateEjection() {}
|
48
|
+
|
43
49
|
bool operator==(const SuccessRateEjection& other) const {
|
44
50
|
return stdev_factor == other.stdev_factor &&
|
45
51
|
enforcement_percentage == other.enforcement_percentage &&
|
46
52
|
minimum_hosts == other.minimum_hosts &&
|
47
53
|
request_volume == other.request_volume;
|
48
54
|
}
|
55
|
+
|
56
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
|
49
57
|
};
|
50
58
|
struct FailurePercentageEjection {
|
51
59
|
uint32_t threshold = 85;
|
@@ -53,12 +61,16 @@ struct OutlierDetectionConfig {
|
|
53
61
|
uint32_t minimum_hosts = 5;
|
54
62
|
uint32_t request_volume = 50;
|
55
63
|
|
64
|
+
FailurePercentageEjection() {}
|
65
|
+
|
56
66
|
bool operator==(const FailurePercentageEjection& other) const {
|
57
67
|
return threshold == other.threshold &&
|
58
68
|
enforcement_percentage == other.enforcement_percentage &&
|
59
69
|
minimum_hosts == other.minimum_hosts &&
|
60
70
|
request_volume == other.request_volume;
|
61
71
|
}
|
72
|
+
|
73
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
|
62
74
|
};
|
63
75
|
absl::optional<SuccessRateEjection> success_rate_ejection;
|
64
76
|
absl::optional<FailurePercentageEjection> failure_percentage_ejection;
|
@@ -71,6 +83,10 @@ struct OutlierDetectionConfig {
|
|
71
83
|
success_rate_ejection == other.success_rate_ejection &&
|
72
84
|
failure_percentage_ejection == other.failure_percentage_ejection;
|
73
85
|
}
|
86
|
+
|
87
|
+
static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
|
88
|
+
void JsonPostLoad(const Json& json, const JsonArgs&,
|
89
|
+
ValidationErrors* errors);
|
74
90
|
};
|
75
91
|
|
76
92
|
} // namespace grpc_core
|
@@ -38,6 +38,7 @@
|
|
38
38
|
|
39
39
|
#include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
|
40
40
|
#include "src/core/lib/channel/channel_args.h"
|
41
|
+
#include "src/core/lib/config/core_configuration.h"
|
41
42
|
#include "src/core/lib/debug/trace.h"
|
42
43
|
#include "src/core/lib/gprpp/debug_location.h"
|
43
44
|
#include "src/core/lib/gprpp/orphanable.h"
|
@@ -68,7 +69,7 @@ class PickFirst : public LoadBalancingPolicy {
|
|
68
69
|
|
69
70
|
absl::string_view name() const override { return kPickFirst; }
|
70
71
|
|
71
|
-
|
72
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
72
73
|
void ExitIdleLocked() override;
|
73
74
|
void ResetBackoffLocked() override;
|
74
75
|
|
@@ -162,9 +163,9 @@ class PickFirst : public LoadBalancingPolicy {
|
|
162
163
|
// Lateset update args.
|
163
164
|
UpdateArgs latest_update_args_;
|
164
165
|
// All our subchannels.
|
165
|
-
|
166
|
+
RefCountedPtr<PickFirstSubchannelList> subchannel_list_;
|
166
167
|
// Latest pending subchannel list.
|
167
|
-
|
168
|
+
RefCountedPtr<PickFirstSubchannelList> latest_pending_subchannel_list_;
|
168
169
|
// Selected subchannel in \a subchannel_list_.
|
169
170
|
PickFirstSubchannelData* selected_ = nullptr;
|
170
171
|
// Are we in IDLE state?
|
@@ -227,11 +228,11 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
227
228
|
"[PF %p] Shutting down previous pending subchannel list %p", this,
|
228
229
|
latest_pending_subchannel_list_.get());
|
229
230
|
}
|
230
|
-
latest_pending_subchannel_list_ =
|
231
|
+
latest_pending_subchannel_list_ = MakeRefCounted<PickFirstSubchannelList>(
|
231
232
|
this, std::move(addresses), latest_update_args_.args);
|
232
233
|
latest_pending_subchannel_list_->StartWatchingLocked();
|
233
234
|
// Empty update or no valid subchannels. Put the channel in
|
234
|
-
// TRANSIENT_FAILURE.
|
235
|
+
// TRANSIENT_FAILURE and request re-resolution.
|
235
236
|
if (latest_pending_subchannel_list_->num_subchannels() == 0) {
|
236
237
|
absl::Status status =
|
237
238
|
latest_update_args_.addresses.ok()
|
@@ -241,6 +242,7 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
241
242
|
channel_control_helper()->UpdateState(
|
242
243
|
GRPC_CHANNEL_TRANSIENT_FAILURE, status,
|
243
244
|
absl::make_unique<TransientFailurePicker>(status));
|
245
|
+
channel_control_helper()->RequestReresolution();
|
244
246
|
}
|
245
247
|
// Otherwise, if this is the initial update, report CONNECTING.
|
246
248
|
else if (subchannel_list_.get() == nullptr) {
|
@@ -262,7 +264,7 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|
262
264
|
}
|
263
265
|
}
|
264
266
|
|
265
|
-
|
267
|
+
absl::Status PickFirst::UpdateLocked(UpdateArgs args) {
|
266
268
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
267
269
|
if (args.addresses.ok()) {
|
268
270
|
gpr_log(GPR_INFO,
|
@@ -275,6 +277,13 @@ void PickFirst::UpdateLocked(UpdateArgs args) {
|
|
275
277
|
}
|
276
278
|
// Add GRPC_ARG_INHIBIT_HEALTH_CHECKING channel arg.
|
277
279
|
args.args = args.args.Set(GRPC_ARG_INHIBIT_HEALTH_CHECKING, 1);
|
280
|
+
// Set return status based on the address list.
|
281
|
+
absl::Status status;
|
282
|
+
if (!args.addresses.ok()) {
|
283
|
+
status = args.addresses.status();
|
284
|
+
} else if (args.addresses->empty()) {
|
285
|
+
status = absl::UnavailableError("address list must not be empty");
|
286
|
+
}
|
278
287
|
// If the update contains a resolver error and we have a previous update
|
279
288
|
// that was not a resolver error, keep using the previous addresses.
|
280
289
|
if (!args.addresses.ok() && latest_update_args_.config != nullptr) {
|
@@ -287,6 +296,7 @@ void PickFirst::UpdateLocked(UpdateArgs args) {
|
|
287
296
|
if (!idle_) {
|
288
297
|
AttemptToConnectUsingLatestUpdateArgsLocked();
|
289
298
|
}
|
299
|
+
return status;
|
290
300
|
}
|
291
301
|
|
292
302
|
void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
@@ -527,12 +537,9 @@ class PickFirstFactory : public LoadBalancingPolicyFactory {
|
|
527
537
|
|
528
538
|
} // namespace
|
529
539
|
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
grpc_core::LoadBalancingPolicyRegistry::Builder::
|
534
|
-
RegisterLoadBalancingPolicyFactory(
|
535
|
-
absl::make_unique<grpc_core::PickFirstFactory>());
|
540
|
+
void RegisterPickFirstLbPolicy(CoreConfiguration::Builder* builder) {
|
541
|
+
builder->lb_policy_registry()->RegisterLoadBalancingPolicyFactory(
|
542
|
+
absl::make_unique<PickFirstFactory>());
|
536
543
|
}
|
537
544
|
|
538
|
-
|
545
|
+
} // namespace grpc_core
|