Commit Graph

4821 Commits

Author SHA1 Message Date
Chengyuan Zhang 0f7fd289a3
xds: implement XdsClient APIs for watching LDS/RDS resources individually (#7470)
Add XdsClient implementation of watching LDS/RDS resources, replacing the ConfigWatcher API. This makes LDS/RDS/CDS/EDS resource watchers work similarly. This change also cleans up XdsClientImpl's tests.
2020-10-02 16:50:07 -07:00
Chengyuan Zhang 7032d4ccd7
xds: sync envoy proto to commit 1c27396b1f7e756ba79eed72b47f485d44da1d41 (#7480) 2020-10-02 14:26:25 -07:00
Chengyuan Zhang 594cc76292
xds: advertise send_all_clusters client feature in LRS requests (#7477) 2020-10-01 13:32:13 -07:00
Eric Anderson ec0d01d7a4 netty: TCP close during TLS handshake should be UNAVAILABLE
Normally the first exception/event experienced is the cause and is
followed by a stampede of ClosedChannelExceptions. In this case,
SslHandler is manufacturing a ClosedChannelException of its own and
propagating it _before_ the trigger event. This might be considered a
bug, but changing SslHandler's behavior would be very risky and almost
certainly break someone's code.

Fixes #7376
2020-10-01 15:12:53 -05:00
Eric Anderson 0cd56c29d6
stub: Only throw on cancellation for streaming responses
Unary are far more common than streaming, and we're throwing for unary even
though it doesn't help the service. Let's stop doing that. We also stop
throwing in onComplete() for all cases, because it doesn't help any service;
it doesn't stop the service's processing and isn't even all that informative
since the cancellation can happen even after onComplete() is called.
2020-10-01 13:10:30 -07:00
ZHANG Dapeng f6c2d221e2
rls: fix wrong synchronization for pickSubchannel()
`RlsPicker.pickSubchannel()` does not run in SynchronizationContext, but it calls `CachingRlsLbClient.get()` which assumed running in SynchronizationContext. Fixed by removing `synchronizationContext.throwIfNotInThisSynchronizationContext()`. `CachingRlsLbClient.get()` is actually thread-safe in the sense it's guarded by lock, and `DataCacheEntry`'s fields are final.

`ChildPolicyWrapper.picker` was not thread-safe. Fixed by making it volatile.

Changed the test a bit since the old test doesn't really test things well.
2020-09-30 15:31:09 -07:00
Eric Anderson 00e2d717a2 netty: BDP ping accounting should occur after flow control
It's hoped that this resolves the "too_many_pings" issue some users are
seeing that is worked around by GRPC_EXPERIMENTAL_AUTOFLOWCONTROL=false.
This change also avoids resetting the ping count for empty data frames
(which shouldn't really happen with gRPC).

The previous code failed to reset the ping count on HEADERS and
WINDOW_UPDATE. The code _appeared_ to have callbacks for WINDOW_UPDATE,
but was layered above the Http2Connection so was never called. Thus,
this version is much more aggressive then the previous version while
also addressing the correctness issue.
2020-09-28 17:23:12 -05:00
Eric Anderson 4c1bab9ed5 Prepare for JUnit 4.13
It deprecates ExpectedException and Assert.assertThat(T, org.hamcrest.Matcher).
Without Java 8 we don't want to migrate away from ExpectedException at
this time. We tend to prefer Truth over Hamcrest, so I swapped the one
instance of Assert.assertThat() to use Truth. With this change we get a
warning-less build with JUnit 4.13. We don't yet upgrade because we
still need to support JUnit 4.12 for some use-cases, but will be able to
upgrade to 4.13 soon when they upgrade.
2020-09-28 17:07:50 -05:00
Chengyuan Zhang 2adeff56fe
xds: refactor resource subscription implementation in XdsClient (#7458)
Introduce ResourceSubscriber for tracking the state of a single resource.

Every time newly subscribing to some resource, a corresponding ResourceSubscriber is created. Note it does not control the resource discovery RPCs. It is still the XdsClient that sends RPCs for with all subscribed resource names for each type. A ResourceSubscriber can have the following states:

  - When the initial resource fetch timer (respTimer) is pending, the resource is under discovery, the resource data is unknown. Even if the XdsClient receives a response not containing the corresponding resource, it does not mean the resource is absent. We still need to wait until a response containing the resource data coming or the timer being fired. The timer is scheduled when the ResourceSubscriber is created. So the XdsClient should always create the corresponding ResourceSubscriber when it starts to subscribe a new resource.

  - If the resource fetch timer is not pending, we must know the existence of the resource data. If data field is set, it is the most recently received resource data (aka, cached entry). Otherwise, absent field is set to true, indicating the resource does not exist. The exceptional case is when the ADS stream is closed and in the retry backoff period. During that period, respTimer is cancelled and the resource existence may or may not be known. Once the backoff finishes, the XdsClient will reschedule the respTimer when it recreates the ADS stream and re-request all the resources.

Watchers can be added to existing ResourceSubscribers. At the time the watcher is added, its callback will be invoked if we've already known the existence of the resource. Otherwise, the watcher will just sit there and wait data or absence to come in the future.
2020-09-28 13:43:41 -07:00
Chengyuan Zhang 950ec30247
xds: delete XdsClientImplV2Test (#7461)
Maintaining two copies of tests is counter-productive. Having the entire set of XdsClientImpl tests for covering v2 protocol usage is an overkill.
2020-09-28 09:59:39 -07:00
ZHANG Dapeng e4c3de6334
rls: fix RLS_DATA_KEY propagation in headers 2020-09-28 09:56:01 -07:00
Chengyuan Zhang 9cbea16ccc
xds: stop setting PROXYLESS_CLIENT_HOSTNAME node metadata in LRS requests (#7459)
The PROXYLESS_CLIENT_HOSTNAME node metadata was a temporary workaround for management server to not send back all backend services as load reporting clusters. Now the management server is able to use `send_all_clusters` field to let the client side decide the group of clusters it is reporting loads for. So this node metadata is no longer needed.
2020-09-25 17:50:25 -07:00
Ran 7ca6c02312
Revert "core: delay sending cancel request on client-side when deadline expires (#6328)" (#7457) 2020-09-25 10:38:21 -07:00
Chengyuan Zhang 10b960ea5d
xds: shut down EDS downstream LB policies when no usable endpoints received (#7452) 2020-09-24 15:08:05 -07:00
Chengyuan Zhang 2e411512be
xds: rename CDS/EDS resource watch interface (#7454) 2020-09-24 10:48:58 -07:00
Chengyuan Zhang 41ba242782
xds: delete old EdsLoadBalancer codepath (#7448) 2020-09-23 17:21:18 -07:00
Chengyuan Zhang f62742561d
xds: add toString() and delete unnecessary equals()/hashCode() for LB configs (#7451) 2020-09-23 17:06:55 -07:00
Chengyuan Zhang f055200566
xds: define individual LDS/RDS data watch interface (#7453) 2020-09-23 17:00:41 -07:00
sanjaypujare 147bee8142
xds: implement fallbackProtocolNegotiator for XdsChannelBuilder (#7438) 2020-09-23 10:35:02 -07:00
ZHANG Dapeng d5668b9ee1
core,xds: remove deprecated rawConfig field from PolicySelection 2020-09-22 18:30:54 -07:00
Chengyuan Zhang bc8c758a3c
xds: log raw response messages in sync context (#7441) 2020-09-22 17:28:45 -07:00
Chengyuan Zhang b434df25cd
xds: generate EDS LB config with hardcoded locality picking policy (#7443) 2020-09-22 16:08:41 -07:00
Sergii Tkachenko ef7846496c
core: Inline AbstractManagedChannelImplBuilder 2020-09-22 10:48:31 -04:00
Chengyuan Zhang a5ae55e984
xds: sync Envoy proto to commit fd28e42f31730f5ed6f13f52999692a4885dd312 (2020-09-15) (#7445)
Sync Envoy proto to commit fd28e42f31730f5ed6f13f52999692a4885dd312 (2020-09-15, internal Envoy import CL: cl/332279092). Suppressed warning for using listening_addresses in Node and added TODO for cleaning it up.
2020-09-21 18:16:28 -07:00
Chengyuan Zhang d333304a2b
xds: promote EdsLoadBalancer2 (#7444)
Effectively migrate to the new codepath of hierarchical LB policies.
2020-09-21 16:44:09 -07:00
Chengyuan Zhang da100e8e49
build, examples, README.md: Update protobuf gradle plugin version to 0.8.13 (#7355)
Updated protobuf gradle plugin version to 0.8.13. Fixed Android Kokoro's memory issue by forcing to use a new Gradle daemon for building the previous commit.
2020-09-21 10:42:06 -07:00
Chengyuan Zhang b31d6830a2
xds: fail to create xDS channel if no server with supported channel creds found (#7400)
Create the xDS channel outside the XdsClient. Throw an XdsInitializationException if the provided server list (parsed from the bootstrap file) can not be used to create such a channel. The exception is caught by the xDS resolver and propagated to the Channel gracefully as a name resolution error.
2020-09-18 17:55:29 -07:00
Chengyuan Zhang e6b61ea207
xds: reimplement EDS LB policy with downstream LB config generations that migrate to hierarchical LB tree codepath (#7391)
Implemented the new EDS LB policy, which generates a LB config for instantiating a hierarchical load balancing subtree. The subtree includes downstream LB policies: 

- priority LB policy, which load balances individual priorities separately
- weighted-target LB policy, which load balances individual localities within the same priority separately
- lrs LB policy, which applies load recording that aggregates load stats for each locality
- leaf LB policy (round_robin)

The EDS LB policy is the place that receives endpoint information from traffic director and organizes the data into a model for hierarchical load balancing for the cluster.
2020-09-18 16:37:55 -07:00
Sergii Tkachenko b571f23ad2
core: Inline AbstractServerImplBuilder 2020-09-18 16:31:08 -04:00
Chengyuan Zhang bf7a42dbd1
api, core: delete io.grpc.LoadBalancer.loadBalancingConfig attribute (#7440) 2020-09-18 12:54:48 -07:00
sanjaypujare 04871dcc2a
xds: bootstrapper fixes: remove extra readBootstrap & avoid parseConfig (#7436) 2020-09-17 21:25:19 -07:00
Chengyuan Zhang 92cbc578a2
xds: remove logging in data path (#7437) 2020-09-17 21:08:54 -07:00
ZHANG Dapeng 3abdb2859f
grpclb: cache requestConnection if no subchannel created
An issue was found during CBT RLS client testing: The RLS lb creates grplb child balancer, calls `grpclb.handleResolvedAddress()` then immediately calls `grpclb.requestConnection()`. The subchannel in `GrpclbState.currentPicker.pickList` contains only `GrpclbState.BUFFER_ENTRY` at the moment `grpclb.requestConnection()` is called, and therefore the `requestConnection()` is no-op, and RPC is hanging.
2020-09-16 16:48:22 -07:00
Chengyuan Zhang 80f6d874cf
core: lint remove redundant field (#7433) 2020-09-16 15:32:20 -07:00
Chengyuan Zhang f04f33efe8
xds: resource (with version info) should persist across ADS streams along with XdsClient lifetime (#7427)
The version_info in the xDS protocol represents the client's knowledge for the state of that resource type. It should persist across ADS stream recreation. Even if the ADS stream is recreated, the XdsClient should persist its knowledge for resources it has received. With this implementation, client and server are stateful across the xDS communication. With persisted version_info, the management server knows resources that the client currently knows even after the stream is recreated. So it does not need to re-send resources that the client received with the previous stream.
2020-09-16 10:51:38 -07:00
Chengyuan Zhang eb871698e3
Revert "SECURITY.md: add instruction for disabling Conscrypt's default TrustManager (#6962)" (#7428)
This reverts commit e089ceaadc.
2020-09-16 10:07:52 -07:00
Sergii Tkachenko cccd940e43
okhttp: cleanup channel in channel builder tests 2020-09-16 11:38:55 -04:00
Russell Shaw 5879b53c57
netty: Add support for IBMJSSE2 (#7422)
This is a very simple change to test for IBMJSSE2 security provider in addition to the others. IBM JRE does not support the Sun provider, but instead has IBMJSSE2 which supports the same API calls.

I tested this on Z/OS machine as now it works when before it couldn't find a security provider
2020-09-16 08:07:52 -07:00
ZHANG Dapeng ee5b5929d5
api,netty: Fix TruthIncompatibleType 2020-09-15 11:22:44 -07:00
Chengyuan Zhang 9dd56a7f0f
xds: throw XdsInitializationException when reading bootstrap file encounters error (#7420)
Introduce XdsInitializationException, which is thrown when gRPC fails to read the xDS bootstrap information, or fails to create the XdsClient object with loaded bootstrap configurations. gRPC components (e.g., the XdsNameResolver) is expected to propagate such exceptions gracefully to the channel.
2020-09-14 16:26:28 -07:00
Sergii Tkachenko af6fbf6b74 okhttp: make OkHttpChannelBuilder final 2020-09-11 19:54:31 -04:00
Sergii Tkachenko d5dcfa737a
all: remove deprecated internal OverrideAuthorityChecker 2020-09-11 19:14:25 -04:00
Chengyuan Zhang 69e8204066
xds: promote XdsNameResolver2 (#7416) 2020-09-11 14:56:03 -07:00
Sergii Tkachenko b927278f22 core: cleanup AbstractManagedChannelImplBuilderTest 2020-09-11 17:07:45 -04:00
Chengyuan Zhang 8ac63626c3
xds: make channel creds required in bootstrap file (#7396) 2020-09-11 10:08:52 -07:00
ZHANG Dapeng 234125ee39
core: re-organize RealChannel with updateConfigSelector()
As mentioned in https://github.com/grpc/grpc-java/pull/7413#issuecomment-690756200 `RealChannel` did not manage `configSelector`, and therefore `configSelector.get()`, `configSelector.set()` and `drainPendingCalls()` were scattered everywhere in `ManagedChannelImpl`. This PR re-organizes `RealChannel` to manage `configSelector`.
2020-09-11 09:35:18 -07:00
ZHANG Dapeng 73dd3672fc
core: fix drainPendingCalls might be called twice
Fixing the bug: if two consecutive name resolution updates are queued together in SynchronizationContext, drainPendingCalls() might be called twice and be broken.
2020-09-10 15:11:19 -07:00
Eric Anderson 49e47a4089 Update README etc to reference 1.32.1 2020-09-10 14:50:48 -05:00
ZHANG Dapeng f3a1a3ff10
core: refactor handle config update with ConfigSelector
Get rid of `ServiceConfigInterceptor` and handle config update with `ConfigSelector` inside `ClientCallImpl`.
2020-09-10 10:32:46 -07:00
Esun Kim dca74af870 Upgrade Conscrypt to 2.5.1 2020-09-10 12:12:11 -05:00