Commit Graph

3928 Commits

Author SHA1 Message Date
Kun Zhang ada575dd24
netty: use singleton for the custom allocator. (#6526)
The allocator has a circular reference that prevents it from GC'ed,
thus causes memory leak if gRPC Channels are created and shutdown
(even cleanly) on a regular basis.

See https://github.com/netty/netty/issues/6891#issuecomment-457809308
and internal b/146074696.
2019-12-16 17:35:40 -08:00
Jihun Cho 16ba163291 stub: fix javadoc to indicate correct version(1.25.0 -> 1.26.0) 2019-12-16 17:08:04 -08:00
ST-DDT 2afe13487c api: Fix javadoc for ManagedChannelBuilder#forTarget(String)
The dns scheme is only the default scheme with grpc-java. Other
libraries could add more NameResolvers and thus change the default. For
compatibility reasons, the schema should therefore be specified
explicitly.
2019-12-16 15:51:53 -08:00
Chengyuan Zhang d007af18e6
xds: fix bug of concluding retry state without checking retry task status (#6519) 2019-12-16 10:43:24 -08:00
Ran f6544bf95c
core: delay sending cancel request on client-side when deadline expires (#6328) 2019-12-16 09:58:36 -08:00
Eric Anderson 4357f7f159 examples: Throw exception in test instead of printStackTrace
Throwing makes cleaner code and also is more helpful if the exception is ever
thrown, as the error will be more clear.
2019-12-16 08:11:51 -08:00
Dounan Shi 9e02cf089e Gracefully shutdown example servers (#6512) 2019-12-13 16:19:45 -08:00
Eric Anderson 1f64ac94a8 Revert "grpclb: shuffle pick first index"
This reverts commit 1949ebd7ef.

The shuffling should be handled by the grpclb server instead.
2019-12-13 13:20:51 -08:00
Kun Zhang c032e2ebf9
Revert "netty: enable io.grpc.netty.useCustomAllocator by default (#6459)" (#6517)
This reverts commit b0e00fd4ba.

It may cause leak of netty native buffers when creating and shutting
down Channels on a regular basis.
2019-12-13 10:48:53 -08:00
Chengyuan Zhang 5c239437a2
xds: add logging for requests sent by XdsClient (#6516) 2019-12-12 17:27:57 -08:00
markb74 d107859145 Support for lazily serialized values in Metadata.
First add a new a Metadata.BinaryStreamMarshaller interface which
serializes to/from instances of InputStream, and a corresponding
Key.of() factory method.

Values set with this type of key will be kept unserialized internally,
alongside a reference to the Marshaller. A new method
InternalMetadata.serializePartial(), returns values which are either
byte[] or InputStream, and allows transport-specific handling of
lazily-serialized values.

For the regular serialize() method, stream-marshalled values will be
converted to byte[] via an InputStreams.
2019-12-12 15:34:30 -08:00
ZHANG Dapeng 75b9fee2d1
xds: fix NPE in fallback mode in CDS flow
In CDS flow, fallback is not supported. The fallback_policy in XdsConfig is null, causing NPE. This PR fixes that bug.
2019-12-12 14:35:50 -08:00
Ran 7f2266bcad
xds: make XdsChannelFactory default instance a constant. (#6513) 2019-12-11 16:55:29 -08:00
Eric Anderson 9a646518cb
netty: NettyServer should close ProtocolNegotiator 2019-12-10 16:46:30 -08:00
Eric Anderson 9485003cf9 core: Release Channel resources before considering terminated 2019-12-10 16:23:38 -08:00
sanjaypujare 76af2c97ea
xds: set UpstreamTlsContext in Attributes (#6500) 2019-12-10 15:41:04 -08:00
ZHANG Dapeng d5eb61c968
xds: drop support for balancer_name in XdsConfig
The balancer_name field in XdsConfig is deprecated and from now on we ignore it and don't support it.
2019-12-10 13:59:10 -08:00
Chengyuan Zhang f70f73f16c
xds: integrate LRS into XdsClient (#6490)
This change integrates invocation of client side load reporting into XdsClient's implementation:

- Changed LRS client implementation based on LRS design changes. In the new design, first LRS request contains a single ClusterStats message with cluster_name set to the cluster (AKA, CDS cluster) that this LRS client is reporting loads for (no stats data in first request). Then server responses back the name of cluster service (AKA, EDS service) to report loads for.

- Implemented newly proposed LRS client API for adding/removing sources of load stats data.

- Implemented XdsClient APIs for initiating/stopping load reporting.
2019-12-09 23:47:31 -08:00
Chengyuan Zhang 942c1c6b5f
xds: fix bug of verifying xDS requests with ordered resource names
Use matcher that takes care of resource name ordering for comparing requests.
2019-12-09 16:39:26 -08:00
Eric Gribkoff e66ab4e63b
xds: update deprecated charset import (#6502) 2019-12-09 16:23:27 -08:00
Chengyuan Zhang 2de5b4e254
xds: move methods for building test xDS proto messages into a utility class (#6501)
Move helper methods for building xDS protobuf messages into a utility class for code sharing. Tests for gRPC components that use `XdsClient` instance may want to use these methods as well.
2019-12-09 12:59:00 -08:00
ZHANG Dapeng 718f0369cb
core: refactor GracefulSwitchLoadBalancer to switch based on LoadBalancer.Factory
`GracefulSwitchLoadBalancer` was doing switch based on `LoadBalancerProvider.getPolicyName()`. This turned out to be very awkward when I have to synthesize a policy name for the provider, and what I actually care about is the identity of the lb provider not necessarily the policy name.

Now `GracefulSwitchLoadBalancer` is doing switch based on identity of `LoadBalancer.Factory`, which is simpler.
2019-12-09 11:57:16 -08:00
Chengyuan Zhang d3d977d096
xds: extract channel creation out of XdsClient's implementation (#6494)
Introduce a `XdsChannelFactory` for gRPC components that instantiate `XdsClient` instances.
2019-12-08 19:10:12 -08:00
ZHANG Dapeng 30688a1eff
xds: remove xds balancer_name from resolved service config
`XdsNameResolver` will eventually send out a CDS config instead EDS config, but balancer_name should never be sent out from `XdsNameResolver` anyway.

This PR is mainly to unblock current staging test.
2019-12-06 14:36:31 -08:00
Liu sheng 470a4ab12d Add support for cross-compiling for aarch64 platform
This change modified the building scripts to support cross compile
grpc-java for aarch64 platform

For grpc/grpc-java#6364
2019-12-06 14:21:34 -08:00
sanjaypujare 3145ef0b7c
xds: implementation of file based plugin credential (#6485) 2019-12-06 10:27:51 -08:00
Chengyuan Zhang d168632f82
xds: support multiple xDS servers in bootstrap file (#6493)
Support bootstrap file containing multiple xDS servers, with each has its own server URI and channel credential options. Multiple xDS servers are provided in case of one not reachable. For now, we would only use the first one.

This change also formats JSON strings in bootstrap related tests and add several tests for parsing bootstrap JSON as completeness.

Implementation of XdsClient is changed to take in a list of xDS servers. But still, we only use the first one.
2019-12-05 16:45:28 -08:00
Tomo Suzuki 29638780ae build: Replaced outdated comments (#6492) 2019-12-05 13:53:51 -08:00
ZHANG Dapeng b739239e8d
xds: apply error handling for FallbackLb.handleResolvedAddresses
Apply the same error handling for `FallbackLb.handleResolvedAddresses()` as `LookasideLb` and `CdsLoadBalancer`.
2019-12-05 13:51:01 -08:00
Tomo Suzuki 80699f8be9 all: bump Animal-sniffer-annotation to 1.18 (#6488) 2019-12-05 13:15:59 -08:00
ZHANG Dapeng 9c2501f146
xds: add CdsLoadBalancer
- Contains `ClusterWatcher` implementation. On cluster update, `ClusterWatcherImpl` spawns an EDS child balancer if not created, then based on the ClusterUpdate data, it sends an edsConfig to the EDS child balancer.
- `CdsLoadBalancer` reads `XdsClientRef` and `CdsConfig` from `resolvedAddresses`. Base on `resolvedAddresses`, it register a `ClusterWatcherImpl` to `XdsClient`.
- For a different cluster resource name in CdsConfig when `handleResolvedAddresses()`, `CdsLoadBalancer` will gracefully switch to the new cluster.
2019-12-05 11:04:54 -08:00
ZHANG Dapeng b833aae615
xds: fix build
Fix build failure of 96da68bab3
https://travis-ci.org/grpc/grpc-java/builds/620854037?utm_source=github_status&utm_medium=notification
2019-12-04 16:00:06 -08:00
Chengyuan Zhang 96da68bab3
xds: modify LRS client interface (#6483)
Add two APIs to LoadReportClient interface:

- addLoadStatsStore(String, LoadStatsStore)

- removeLoadStatsStore(String)

Each LoadReportClient is responsible for reporting loads for a single cluster. But a gRPC client can spread loads to multiple EDS services per cluster, while loads for each EDS service should be aggregated separately.

With this change, starting a LoadReportClient only starts LRS RPC, the source of load data to be reported is added via addLoadStatsStore API.
2019-12-04 14:22:30 -08:00
sanjaypujare 5b837c4a59
xds: add UpstreamTlsContext to ClusterUpdate (#6481) 2019-12-04 13:18:42 -08:00
ZHANG Dapeng 6b2e754746
xds: refactor EDS policy to use ObjectPool<XdsClient> with error handling fixes (#6450) 2019-12-04 10:40:20 -08:00
Eric Gribkoff bfa085a1cf
Start 1.27.0 development cycle (#6480) 2019-12-03 17:27:55 -08:00
Eric Anderson 2d592642ad Update Bazel+Javalite to 3.11
Bazel was stuck on the javalite branch of protobuf because the master
branch was lacking the toolchain necessary for javalite. The fix was
backported to 3.11 in protocolbuffers/protobuf#6976
2019-12-03 17:01:08 -08:00
Jihun Cho 1573e0d400
netty: log NativeIoException as FINE level (#6477)
resolves #6478
2019-12-03 13:05:04 -08:00
Eric Anderson 54b7847a7f Update protobuf to 3.11.0 and gson to 2.8.6
Updating Protobuf to bring in improvements for Android.

Protobuf pulls in the newer version of gson and we are happy to update
to it.
2019-12-02 16:43:06 -08:00
Jiangtao Li 0dfda93395
alts: fix lazychannel close (#6475) 2019-12-02 15:33:31 -08:00
Chengyuan Zhang 06dd24e248
xds: integrate CDS protocol in XdsClient (#6416)
Add CDS protocol integration into XdsClient. gRPC client interacts with XdsClient for CDS results via adding a cluster watcher to receive cluster information from traffic director. Multiple watchers can exist to receive cluster information for the same or different clusters.
2019-12-02 13:57:36 -08:00
ZHANG Dapeng 8062406afc
interop-testing,core: interop test to get remote address attributes
Adding interop-test for getting remote server address from client interceptor. Also added this feature to inprocess transport.
2019-12-02 13:30:55 -08:00
sanjaypujare 7b6ab2558c
xds: Implementation of SdsSslContextProvider using SdsClient (#6444) 2019-11-27 15:17:12 -08:00
Jihun Cho 09d5093295
xds: simplify condition (#6463) 2019-11-25 13:22:38 -08:00
Jihun Cho 7db873f1f6
Roll-forward of stub,compiler: generated stub extends Abstract{Async,Future,Blocking}Stub #6196 (#6458)
This reverts commit 2eb3f8c34e (#6317).
2019-11-25 09:41:16 -08:00
Chengyuan Zhang 0a0d9f6684
xds: integrate EDS protocol into XdsClient (#6370)
This change implements EDS protocol in XdsClient, which requests for endpoint information for a given cluster for gRPC's load balancing usage. Note EDS is a quasi-incremental protocol, which means each response may contain only a subset of present resources. Absence of resources should be revealed by response timeout. Currently, timeout is not implemented, endpoint watchers will wait indefinitely if endpoints for the cluster interested in does not exist.
2019-11-24 23:35:58 -08:00
Kun Zhang b0e00fd4ba
netty: enable io.grpc.netty.useCustomAllocator by default (#6459) 2019-11-22 16:13:35 -08:00
Chengyuan Zhang eb21c646b2
api, core: make scheduled executor service accessible for NameResolver.Args (#6455)
Added new API on NameResolver.Args to access ScheduledExecutorService, which is wrapped transport executor.
2019-11-21 16:14:13 -08:00
ZHANG Dapeng 81efecd86a
remove getLoadStatsStore method from LocalityStore
Currently `LoadStatsStore` is create by `LocalityStore` and `LoadReportClient` retrieves `LoadStatsStore` from `LocalityStore.getLoadStatsStore()`.

But `LocalityStore` is create by EDS policy, whereas `LoadReportClient` and `LoadStatsStore` should be created by CDS (if not EDS-only), before `LocalityStore` is created. If `LoadReportClient` is embedded in `XdsClientImpl`, it need a `LoadStatsStore` which shouldn't be created by `LocalityStore`.

Instead, `LoadStatsStore` should be create before `LocalityStore` is created, and be passed to `LocalityStore`'s constructor. A getter is not needed.
2019-11-21 12:37:48 -08:00
Jihun Cho eaf99cf7fe
core,xds: add missing JUnit RunWith annotation (#6457) 2019-11-21 11:52:34 -08:00