grpc 1.39.0 → 1.40.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 +20 -4
- data/include/grpc/event_engine/event_engine.h +10 -14
- data/include/grpc/event_engine/slice_allocator.h +8 -33
- data/include/grpc/impl/codegen/grpc_types.h +18 -8
- data/include/grpc/impl/codegen/port_platform.h +24 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +413 -247
- data/src/core/ext/filters/client_channel/client_channel.h +42 -18
- data/src/core/ext/filters/client_channel/config_selector.h +19 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +7 -8
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +12 -21
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +3 -5
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +17 -38
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +8 -15
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +8 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -22
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +2 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +5 -8
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -15
- data/src/core/ext/filters/client_channel/lb_policy.h +70 -46
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +101 -73
- data/src/core/ext/filters/client_channel/retry_filter.cc +392 -243
- data/src/core/ext/filters/client_channel/retry_service_config.cc +36 -26
- data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
- data/src/core/ext/filters/client_channel/service_config_call_data.h +45 -5
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +0 -6
- data/src/core/ext/filters/http/client/http_client_filter.cc +5 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +5 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +1 -1
- data/src/core/{lib/event_engine/slice_allocator.cc → ext/transport/chttp2/transport/chttp2_slice_allocator.cc} +15 -38
- data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +74 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +2 -6
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +639 -752
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +190 -69
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -1
- data/src/core/ext/transport/chttp2/transport/parsing.cc +70 -54
- data/src/core/ext/transport/chttp2/transport/varint.cc +6 -4
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +56 -35
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +180 -76
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +35 -27
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +97 -48
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +45 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +67 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +66 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +227 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +121 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +90 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +32 -24
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +120 -73
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +15 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +48 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +171 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +8 -6
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +27 -19
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -7
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +57 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +29 -17
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +72 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +4 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +15 -11
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +85 -43
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +274 -91
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +11 -8
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +30 -13
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +33 -5
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +115 -0
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +60 -0
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +181 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +1 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +82 -66
- data/src/core/ext/upb-generated/validate/validate.upb.h +220 -124
- data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +15 -7
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +53 -52
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +318 -277
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +437 -410
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +198 -170
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +9 -8
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +219 -163
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +59 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +29 -25
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +52 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +135 -125
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +131 -123
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +90 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +32 -24
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +69 -55
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +684 -664
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +13 -10
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +13 -10
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +441 -375
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +122 -114
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +1 -1
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +112 -79
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +64 -0
- data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +35 -32
- data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +4 -4
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +182 -160
- data/src/core/ext/xds/certificate_provider_store.h +1 -1
- data/src/core/ext/xds/xds_api.cc +320 -121
- data/src/core/ext/xds/xds_api.h +31 -2
- data/src/core/ext/xds/xds_bootstrap.cc +4 -1
- data/src/core/ext/xds/xds_client.cc +66 -43
- data/src/core/ext/xds/xds_client.h +0 -4
- data/src/core/ext/xds/xds_http_filters.cc +3 -2
- data/src/core/ext/xds/xds_http_filters.h +3 -0
- data/src/core/lib/channel/call_tracer.h +85 -0
- data/src/core/lib/channel/channel_stack.h +1 -1
- data/src/core/lib/channel/context.h +3 -0
- data/src/core/lib/channel/status_util.h +4 -0
- data/src/core/lib/compression/stream_compression.h +1 -1
- data/src/core/lib/compression/stream_compression_gzip.h +1 -1
- data/src/core/lib/compression/stream_compression_identity.h +1 -1
- data/src/core/lib/debug/stats.h +1 -1
- data/src/core/lib/gpr/murmur_hash.cc +4 -2
- data/src/core/lib/gprpp/manual_constructor.h +1 -1
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/sync.h +2 -30
- data/src/core/lib/iomgr/buffer_list.cc +1 -1
- data/src/core/lib/iomgr/ev_apple.h +1 -1
- data/src/core/lib/iomgr/event_engine/endpoint.cc +6 -8
- data/src/core/lib/iomgr/event_engine/tcp.cc +30 -10
- data/src/core/lib/iomgr/python_util.h +1 -1
- data/src/core/lib/iomgr/resource_quota.cc +2 -0
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +1 -0
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/json/json_reader.cc +1 -2
- data/src/core/lib/matchers/matchers.cc +8 -20
- data/src/core/lib/matchers/matchers.h +2 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +49 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -0
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +6 -18
- data/src/core/lib/security/transport/security_handshaker.cc +12 -4
- data/src/core/lib/security/transport/server_auth_filter.cc +0 -7
- data/src/core/lib/slice/slice_internal.h +1 -0
- data/src/core/lib/surface/call.cc +5 -6
- data/src/core/lib/surface/server.cc +3 -1
- data/src/core/lib/surface/server.h +3 -3
- data/src/core/lib/surface/version.cc +1 -3
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/xxhash/xxhash.h +77 -195
- metadata +52 -35
- data/src/core/lib/gpr/arena.h +0 -47
data/src/core/ext/xds/xds_api.h
CHANGED
@@ -38,6 +38,7 @@
|
|
38
38
|
#include "src/core/ext/xds/xds_bootstrap.h"
|
39
39
|
#include "src/core/ext/xds/xds_client_stats.h"
|
40
40
|
#include "src/core/ext/xds/xds_http_filters.h"
|
41
|
+
#include "src/core/lib/channel/status_util.h"
|
41
42
|
#include "src/core/lib/matchers/matchers.h"
|
42
43
|
|
43
44
|
namespace grpc_core {
|
@@ -109,10 +110,34 @@ class XdsApi {
|
|
109
110
|
bool operator==(const HashPolicy& other) const;
|
110
111
|
std::string ToString() const;
|
111
112
|
};
|
112
|
-
|
113
113
|
Matchers matchers;
|
114
114
|
std::vector<HashPolicy> hash_policies;
|
115
115
|
|
116
|
+
struct RetryPolicy {
|
117
|
+
internal::StatusCodeSet retry_on;
|
118
|
+
uint32_t num_retries;
|
119
|
+
|
120
|
+
struct RetryBackOff {
|
121
|
+
Duration base_interval;
|
122
|
+
Duration max_interval;
|
123
|
+
|
124
|
+
bool operator==(const RetryBackOff& other) const {
|
125
|
+
return base_interval == other.base_interval &&
|
126
|
+
max_interval == other.max_interval;
|
127
|
+
}
|
128
|
+
std::string ToString() const;
|
129
|
+
};
|
130
|
+
RetryBackOff retry_back_off;
|
131
|
+
|
132
|
+
bool operator==(const RetryPolicy& other) const {
|
133
|
+
return (retry_on == other.retry_on &&
|
134
|
+
num_retries == other.num_retries &&
|
135
|
+
retry_back_off == other.retry_back_off);
|
136
|
+
}
|
137
|
+
std::string ToString() const;
|
138
|
+
};
|
139
|
+
absl::optional<RetryPolicy> retry_policy;
|
140
|
+
|
116
141
|
// Action for this route.
|
117
142
|
// TODO(roth): When we can use absl::variant<>, consider using that
|
118
143
|
// here, to enforce the fact that only one of the two fields can be set.
|
@@ -139,6 +164,7 @@ class XdsApi {
|
|
139
164
|
|
140
165
|
bool operator==(const Route& other) const {
|
141
166
|
return matchers == other.matchers && cluster_name == other.cluster_name &&
|
167
|
+
retry_policy == other.retry_policy &&
|
142
168
|
weighted_clusters == other.weighted_clusters &&
|
143
169
|
max_stream_duration == other.max_stream_duration &&
|
144
170
|
typed_per_filter_config == other.typed_per_filter_config;
|
@@ -628,7 +654,8 @@ class XdsApi {
|
|
628
654
|
std::set<std::string> resource_names_failed;
|
629
655
|
};
|
630
656
|
|
631
|
-
XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node
|
657
|
+
XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node,
|
658
|
+
const CertificateProviderStore::PluginDefinitionMap* map);
|
632
659
|
|
633
660
|
// Creates an ADS request.
|
634
661
|
// Takes ownership of \a error.
|
@@ -669,6 +696,8 @@ class XdsApi {
|
|
669
696
|
XdsClient* client_;
|
670
697
|
TraceFlag* tracer_;
|
671
698
|
const XdsBootstrap::Node* node_; // Do not own.
|
699
|
+
const CertificateProviderStore::PluginDefinitionMap*
|
700
|
+
certificate_provider_definition_map_; // Do not own.
|
672
701
|
upb::SymbolTable symtab_;
|
673
702
|
const std::string build_version_;
|
674
703
|
const std::string user_agent_name_;
|
@@ -403,7 +403,10 @@ grpc_error_handle XdsBootstrap::ParseCertificateProvider(
|
|
403
403
|
CertificateProviderFactory* factory =
|
404
404
|
CertificateProviderRegistry::LookupCertificateProviderFactory(
|
405
405
|
plugin_name);
|
406
|
-
if (factory
|
406
|
+
if (factory == nullptr) {
|
407
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
408
|
+
absl::StrCat("Unrecognized plugin name: ", plugin_name).c_str()));
|
409
|
+
} else {
|
407
410
|
RefCountedPtr<CertificateProviderFactory::Config> config;
|
408
411
|
it = certificate_provider_json->mutable_object()->find("config");
|
409
412
|
if (it != certificate_provider_json->mutable_object()->end()) {
|
@@ -275,6 +275,12 @@ class XdsClient::ChannelState::AdsCallState
|
|
275
275
|
XdsApi::EdsUpdateMap eds_update_map)
|
276
276
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
|
277
277
|
|
278
|
+
template <typename StateMap>
|
279
|
+
void RejectAdsUpdateLocked(grpc_millis update_time,
|
280
|
+
const XdsApi::AdsParseResult& result,
|
281
|
+
StateMap* state_map)
|
282
|
+
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
|
283
|
+
|
278
284
|
static void OnRequestSent(void* arg, grpc_error_handle error);
|
279
285
|
void OnRequestSentLocked(grpc_error_handle error)
|
280
286
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
|
@@ -1145,6 +1151,47 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdateLocked(
|
|
1145
1151
|
}
|
1146
1152
|
}
|
1147
1153
|
|
1154
|
+
namespace {
|
1155
|
+
|
1156
|
+
// Update resource_metadata for NACK.
|
1157
|
+
void UpdateResourceMetadataNacked(const std::string& version,
|
1158
|
+
const std::string& details,
|
1159
|
+
grpc_millis update_time,
|
1160
|
+
XdsApi::ResourceMetadata* resource_metadata) {
|
1161
|
+
resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
|
1162
|
+
resource_metadata->failed_version = version;
|
1163
|
+
resource_metadata->failed_details = details;
|
1164
|
+
resource_metadata->failed_update_time = update_time;
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
} // namespace
|
1168
|
+
|
1169
|
+
template <typename StateMap>
|
1170
|
+
void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
|
1171
|
+
grpc_millis update_time, const XdsApi::AdsParseResult& result,
|
1172
|
+
StateMap* state_map) {
|
1173
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1174
|
+
gpr_log(GPR_INFO,
|
1175
|
+
"[xds_client %p] %s update NACKed containing %" PRIuPTR
|
1176
|
+
" resources",
|
1177
|
+
xds_client(), result.type_url.c_str(),
|
1178
|
+
result.resource_names_failed.size());
|
1179
|
+
}
|
1180
|
+
std::string details = grpc_error_std_string(result.parse_error);
|
1181
|
+
for (auto& name : result.resource_names_failed) {
|
1182
|
+
auto it = state_map->find(name);
|
1183
|
+
if (it == state_map->end()) continue;
|
1184
|
+
auto& state = it->second;
|
1185
|
+
// Notify watchers of error.
|
1186
|
+
for (const auto& p : state.watchers) {
|
1187
|
+
p.first->OnError(GRPC_ERROR_REF(result.parse_error));
|
1188
|
+
}
|
1189
|
+
// Update resource metadata for CSDS.
|
1190
|
+
UpdateResourceMetadataNacked(result.version, details, update_time,
|
1191
|
+
&state.meta);
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
|
1148
1195
|
void XdsClient::ChannelState::AdsCallState::OnRequestSent(
|
1149
1196
|
void* arg, grpc_error_handle error) {
|
1150
1197
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
@@ -1223,10 +1270,6 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
|
|
1223
1270
|
state.nonce = std::move(result.nonce);
|
1224
1271
|
// NACK or ACK the response.
|
1225
1272
|
if (result.parse_error != GRPC_ERROR_NONE) {
|
1226
|
-
xds_client()->UpdateResourceMetadataWithFailedParseResultLocked(
|
1227
|
-
update_time, result);
|
1228
|
-
GRPC_ERROR_UNREF(state.error);
|
1229
|
-
state.error = result.parse_error;
|
1230
1273
|
// NACK unacceptable update.
|
1231
1274
|
gpr_log(GPR_ERROR,
|
1232
1275
|
"[xds_client %p] ADS response invalid for resource type %s "
|
@@ -1234,6 +1277,23 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
|
|
1234
1277
|
xds_client(), result.type_url.c_str(), result.version.c_str(),
|
1235
1278
|
state.nonce.c_str(),
|
1236
1279
|
grpc_error_std_string(result.parse_error).c_str());
|
1280
|
+
result.parse_error =
|
1281
|
+
grpc_error_set_int(result.parse_error, GRPC_ERROR_INT_GRPC_STATUS,
|
1282
|
+
GRPC_STATUS_UNAVAILABLE);
|
1283
|
+
GRPC_ERROR_UNREF(state.error);
|
1284
|
+
state.error = result.parse_error;
|
1285
|
+
if (result.type_url == XdsApi::kLdsTypeUrl) {
|
1286
|
+
RejectAdsUpdateLocked(update_time, result,
|
1287
|
+
&xds_client()->listener_map_);
|
1288
|
+
} else if (result.type_url == XdsApi::kRdsTypeUrl) {
|
1289
|
+
RejectAdsUpdateLocked(update_time, result,
|
1290
|
+
&xds_client()->route_config_map_);
|
1291
|
+
} else if (result.type_url == XdsApi::kCdsTypeUrl) {
|
1292
|
+
RejectAdsUpdateLocked(update_time, result, &xds_client()->cluster_map_);
|
1293
|
+
} else if (result.type_url == XdsApi::kEdsTypeUrl) {
|
1294
|
+
RejectAdsUpdateLocked(update_time, result,
|
1295
|
+
&xds_client()->endpoint_map_);
|
1296
|
+
}
|
1237
1297
|
SendMessageLocked(result.type_url);
|
1238
1298
|
} else {
|
1239
1299
|
seen_response_ = true;
|
@@ -1803,7 +1863,8 @@ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
|
|
1803
1863
|
interested_parties_(grpc_pollset_set_create()),
|
1804
1864
|
certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
|
1805
1865
|
bootstrap_->certificate_providers())),
|
1806
|
-
api_(this, &grpc_xds_client_trace, bootstrap_->node()
|
1866
|
+
api_(this, &grpc_xds_client_trace, bootstrap_->node(),
|
1867
|
+
&bootstrap_->certificate_providers()) {
|
1807
1868
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1808
1869
|
gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
|
1809
1870
|
}
|
@@ -2252,44 +2313,6 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
|
|
2252
2313
|
return snapshot_map;
|
2253
2314
|
}
|
2254
2315
|
|
2255
|
-
void XdsClient::UpdateResourceMetadataWithFailedParseResultLocked(
|
2256
|
-
grpc_millis update_time, const XdsApi::AdsParseResult& result) {
|
2257
|
-
// ADS update is rejected and the resource names in the failed update is
|
2258
|
-
// available.
|
2259
|
-
std::string details = grpc_error_std_string(result.parse_error);
|
2260
|
-
for (auto& name : result.resource_names_failed) {
|
2261
|
-
XdsApi::ResourceMetadata* resource_metadata = nullptr;
|
2262
|
-
if (result.type_url == XdsApi::kLdsTypeUrl) {
|
2263
|
-
auto it = listener_map_.find(name);
|
2264
|
-
if (it != listener_map_.end()) {
|
2265
|
-
resource_metadata = &it->second.meta;
|
2266
|
-
}
|
2267
|
-
} else if (result.type_url == XdsApi::kRdsTypeUrl) {
|
2268
|
-
auto it = route_config_map_.find(name);
|
2269
|
-
if (route_config_map_.find(name) != route_config_map_.end()) {
|
2270
|
-
resource_metadata = &it->second.meta;
|
2271
|
-
}
|
2272
|
-
} else if (result.type_url == XdsApi::kCdsTypeUrl) {
|
2273
|
-
auto it = cluster_map_.find(name);
|
2274
|
-
if (cluster_map_.find(name) != cluster_map_.end()) {
|
2275
|
-
resource_metadata = &it->second.meta;
|
2276
|
-
}
|
2277
|
-
} else if (result.type_url == XdsApi::kEdsTypeUrl) {
|
2278
|
-
auto it = endpoint_map_.find(name);
|
2279
|
-
if (endpoint_map_.find(name) != endpoint_map_.end()) {
|
2280
|
-
resource_metadata = &it->second.meta;
|
2281
|
-
}
|
2282
|
-
}
|
2283
|
-
if (resource_metadata == nullptr) {
|
2284
|
-
return;
|
2285
|
-
}
|
2286
|
-
resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
|
2287
|
-
resource_metadata->failed_version = result.version;
|
2288
|
-
resource_metadata->failed_details = details;
|
2289
|
-
resource_metadata->failed_update_time = update_time;
|
2290
|
-
}
|
2291
|
-
}
|
2292
|
-
|
2293
2316
|
std::string XdsClient::DumpClientConfigBinary() {
|
2294
2317
|
MutexLock lock(&mu_);
|
2295
2318
|
XdsApi::ResourceTypeMetadataMap resource_type_metadata_map;
|
@@ -324,10 +324,6 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
324
324
|
bool send_all_clusters, const std::set<std::string>& clusters)
|
325
325
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
326
326
|
|
327
|
-
void UpdateResourceMetadataWithFailedParseResultLocked(
|
328
|
-
grpc_millis update_time, const XdsApi::AdsParseResult& result)
|
329
|
-
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
330
|
-
|
331
327
|
std::unique_ptr<XdsBootstrap> bootstrap_;
|
332
328
|
grpc_channel_args* args_;
|
333
329
|
const grpc_millis request_timeout_;
|
@@ -52,10 +52,9 @@ class XdsHttpRouterFilter : public XdsHttpFilterImpl {
|
|
52
52
|
"router filter does not support config override");
|
53
53
|
}
|
54
54
|
|
55
|
-
// No-op -- this filter is special-cased by the xds resolver.
|
56
55
|
const grpc_channel_filter* channel_filter() const override { return nullptr; }
|
57
56
|
|
58
|
-
// No-op
|
57
|
+
// No-op. This will never be called, since channel_filter() returns null.
|
59
58
|
absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
|
60
59
|
const FilterConfig& /*hcm_filter_config*/,
|
61
60
|
const FilterConfig* /*filter_config_override*/) const override {
|
@@ -65,6 +64,8 @@ class XdsHttpRouterFilter : public XdsHttpFilterImpl {
|
|
65
64
|
bool IsSupportedOnClients() const override { return true; }
|
66
65
|
|
67
66
|
bool IsSupportedOnServers() const override { return true; }
|
67
|
+
|
68
|
+
bool IsTerminalFilter() const override { return true; }
|
68
69
|
};
|
69
70
|
|
70
71
|
using FilterOwnerList = std::vector<std::unique_ptr<XdsHttpFilterImpl>>;
|
@@ -107,6 +107,9 @@ class XdsHttpFilterImpl {
|
|
107
107
|
|
108
108
|
// Returns true if the filter is supported on servers; false otherwise
|
109
109
|
virtual bool IsSupportedOnServers() const = 0;
|
110
|
+
|
111
|
+
// Returns true if the filter must be the last filter in the chain.
|
112
|
+
virtual bool IsTerminalFilter() const { return false; }
|
110
113
|
};
|
111
114
|
|
112
115
|
class XdsHttpFilterRegistry {
|
@@ -0,0 +1,85 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Copyright 2021 gRPC authors.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
//
|
17
|
+
//
|
18
|
+
|
19
|
+
#ifndef GRPC_CORE_LIB_CHANNEL_CALL_TRACER_H
|
20
|
+
#define GRPC_CORE_LIB_CHANNEL_CALL_TRACER_H
|
21
|
+
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
24
|
+
#include "absl/strings/string_view.h"
|
25
|
+
|
26
|
+
#include "src/core/lib/channel/channel_stack.h"
|
27
|
+
#include "src/core/lib/transport/byte_stream.h"
|
28
|
+
#include "src/core/lib/transport/metadata_batch.h"
|
29
|
+
|
30
|
+
namespace grpc_core {
|
31
|
+
|
32
|
+
// Interface for a tracer that records activities on a call. Actual attempts for
|
33
|
+
// this call are traced with CallAttemptTracer after invoking RecordNewAttempt()
|
34
|
+
// on the CallTracer object.
|
35
|
+
class CallTracer {
|
36
|
+
public:
|
37
|
+
// Interface for a tracer that records activities on a particular call
|
38
|
+
// attempt.
|
39
|
+
// (A single RPC can have multiple attempts due to retry/hedging policies or
|
40
|
+
// as transparent retry attempts.)
|
41
|
+
class CallAttemptTracer {
|
42
|
+
public:
|
43
|
+
virtual ~CallAttemptTracer() {}
|
44
|
+
// Please refer to `grpc_transport_stream_op_batch_payload` for details on
|
45
|
+
// arguments.
|
46
|
+
virtual void RecordSendInitialMetadata(
|
47
|
+
grpc_metadata_batch* send_initial_metadata, uint32_t flags) = 0;
|
48
|
+
// TODO(yashkt): We are using gpr_atm here instead of absl::string_view
|
49
|
+
// since that's what the transport API uses, and performing an atomic load
|
50
|
+
// is unnecessary if the census tracer does not need it at present. Fix this
|
51
|
+
// when the transport API changes.
|
52
|
+
virtual void RecordOnDoneSendInitialMetadata(gpr_atm* peer_string) = 0;
|
53
|
+
virtual void RecordSendTrailingMetadata(
|
54
|
+
grpc_metadata_batch* send_trailing_metadata) = 0;
|
55
|
+
virtual void RecordSendMessage(const ByteStream& send_message) = 0;
|
56
|
+
// The `RecordReceivedInitialMetadata()` and `RecordReceivedMessage()`
|
57
|
+
// methods should only be invoked when the metadata/message was
|
58
|
+
// successfully received, i.e., without any error.
|
59
|
+
virtual void RecordReceivedInitialMetadata(
|
60
|
+
grpc_metadata_batch* recv_initial_metadata, uint32_t flags) = 0;
|
61
|
+
virtual void RecordReceivedMessage(const ByteStream& recv_message) = 0;
|
62
|
+
virtual void RecordReceivedTrailingMetadata(
|
63
|
+
absl::Status status, grpc_metadata_batch* recv_trailing_metadata,
|
64
|
+
const grpc_transport_stream_stats& transport_stream_stats) = 0;
|
65
|
+
virtual void RecordCancel(grpc_error_handle cancel_error) = 0;
|
66
|
+
// Should be the last API call to the object. Once invoked, the tracer
|
67
|
+
// library is free to destroy the object.
|
68
|
+
virtual void RecordEnd(const gpr_timespec& latency) = 0;
|
69
|
+
};
|
70
|
+
|
71
|
+
virtual ~CallTracer() {}
|
72
|
+
|
73
|
+
// Records a new attempt for the associated call. \a transparent denotes
|
74
|
+
// whether the attempt is being made as a transparent retry or as a
|
75
|
+
// non-transparent retry/heding attempt. (There will be at least one attempt
|
76
|
+
// even if the call is not being retried.) The `CallTracer` object retains
|
77
|
+
// ownership to the newly created `CallAttemptTracer` object. RecordEnd()
|
78
|
+
// serves as an indication that the call stack is done with all API calls, and
|
79
|
+
// the tracer library is free to destroy it after that.
|
80
|
+
virtual CallAttemptTracer* StartNewAttempt(bool is_transparent_retry) = 0;
|
81
|
+
};
|
82
|
+
|
83
|
+
} // namespace grpc_core
|
84
|
+
|
85
|
+
#endif // GRPC_CORE_LIB_CHANNEL_CALL_TRACER_H
|
@@ -78,7 +78,7 @@ struct grpc_call_element_args {
|
|
78
78
|
const void* server_transport_data;
|
79
79
|
grpc_call_context_element* context;
|
80
80
|
const grpc_slice& path;
|
81
|
-
gpr_cycle_counter start_time;
|
81
|
+
gpr_cycle_counter start_time; // Note: not populated in subchannel stack.
|
82
82
|
grpc_millis deadline;
|
83
83
|
grpc_core::Arena* arena;
|
84
84
|
grpc_core::CallCombiner* call_combiner;
|
@@ -53,6 +53,10 @@ class StatusCodeSet {
|
|
53
53
|
return status_code_mask_ & (1 << status);
|
54
54
|
}
|
55
55
|
|
56
|
+
bool operator==(const StatusCodeSet& other) const {
|
57
|
+
return status_code_mask_ == other.status_code_mask_;
|
58
|
+
}
|
59
|
+
|
56
60
|
private:
|
57
61
|
int status_code_mask_ = 0; // A bitfield of status codes in the set.
|
58
62
|
};
|
data/src/core/lib/debug/stats.h
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include "absl/base/attributes.h"
|
26
|
+
|
25
27
|
#define ROTL32(x, r) (((x) << (r)) | ((x) >> (32 - (r))))
|
26
28
|
|
27
29
|
#define FMIX32(h) \
|
@@ -61,10 +63,10 @@ uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed) {
|
|
61
63
|
switch (len & 3) {
|
62
64
|
case 3:
|
63
65
|
k1 ^= (static_cast<uint32_t>(keyptr[2])) << 16;
|
64
|
-
|
66
|
+
ABSL_FALLTHROUGH_INTENDED;
|
65
67
|
case 2:
|
66
68
|
k1 ^= (static_cast<uint32_t>(keyptr[1])) << 8;
|
67
|
-
|
69
|
+
ABSL_FALLTHROUGH_INTENDED;
|
68
70
|
case 1:
|
69
71
|
k1 ^= keyptr[0];
|
70
72
|
k1 *= c1;
|