Commit Graph

49 Commits

Author SHA1 Message Date
skyguard1 96a5c25056
rls: fix routeLookupClient may be null in RlsLoadBalancer.requestConnection() (#8379) 2021-08-09 20:22:44 -07:00
Eric Anderson 0cabf5672a compiler: Add GrpcGenerated annotation to generated class
This can be used by annotation processors to avoid processing the
gRPC-generated code. The normal Generated annotation only has SOURCE
retention, so isn't available to annotation processors.

I don't include the service name within the annotation as that assumes
we'll never have need for any other type of generated class. If there's
a request for exposing service name via an annotation in the future, we
can make an RpcService annotation or the like.

Fixes #8158
2021-07-02 22:11:40 -07:00
Eric Anderson 5642e01243
Replace failOnVersionConflict() with custom requireUpperBoundDeps
failOnVersionConflict has never been good for us. It is equivalent to
Maven dependencyConvergence which we discourage our users to use because
it is too tempermental and _creates_ version skew issues over time.
However, we had no real alternative for determining if our deps would be
misinterpeted by Maven.

failOnVersionConflict has been a constant drain and makes it really hard
to do seemingly-trivial upgrades. As evidenced by protobuf/build.gradle
in this change, it also caused _us_ to introduce a version downgrade.

This introduces our own custom requireUpperBoundDeps implementation so
that we can get back to simple dependency upgrades _and_ increase our
confidence in a consistent dependency tree.
2021-06-11 14:01:18 -07:00
Penn (Dapeng) Zhang 11c0d1d81e rls: update rls proto 2021-06-11 13:28:48 -07:00
Chengyuan Zhang 9614738a7d
core, grpclb, xds: let leaf LB policies explicitly refresh name resolution when subchannel connection is broken (#8048)
Currently each subchannel implicitly refreshes the name resolution when its state changes to IDLE or TRANSIENT_FAILURE. That is, this feature is built into subchannel's internal implementation. Although it eliminates the burden of having LB implementations refreshing the resolver when connections to backends are broken, this is gives LB policies no chance to disable or override this refresh (e.g., in some complex load balancing hierarchy like xDS, LB policies may embed a resolver inside for resolving backends so the refreshing resolution operation should be hooked to the resolver embedded in the LB policy instead of the one in Channel).

In order to make this transition smoothly, we add a check to SubchannelImpl that checks if the LoadBalancer has explicitly called Helper.refreshNameResolution for broken subchannels created by it. If not, it logs a warning and do the refresh.

A temporary LoadBalancer.Helper API ignoreRefreshNameResolution() is added to avoid false-positive warnings for xDS that intentionally does not want a refresh. Once the migration is done, this should be deleted.
2021-04-16 10:49:06 -07:00
ZHANG Dapeng e73f31a561
rls: fix rls oobChannel grpclb config service name
The serviceName field in oobChannel grpclb config should not be null, otherwise it will default to the lbHelper.getAuthority(), which perviously defaulted to the lookup service before #7852, but has been overridden to the backend service for authentication in #7852.
2021-02-17 10:10:50 -08:00
ZHANG Dapeng 7d9ee8f051
rls: fix wrong server field in lookup request again
The previous fix #7878 didn't work because the server field is expected to be full hostname (without port number). Need strip the port part from the authority.
2021-02-10 16:33:59 -08:00
ZHANG Dapeng 23bb2ebf31
all: publish grpc-rls
Making `io.grpc:grpc-rls` a maven artifact from next release.
2021-02-08 21:39:54 -08:00
ZHANG Dapeng cb3317b1fd
rls: fix wrong lookup request server field
The server filed in lookup request as specified in go/dynamic-request-routing/#heading=h.eqjtcpo6u8ep should be the original target, not the RLS server where the lookup request is sent to.
2021-02-08 15:53:36 -08:00
ZHANG Dapeng 2cd45e7a24
rls: forcefully close rls channel when lb is shutdown
RLS RPC deadline is configured by service config, and could be extremely long. When RLS lb is shutdown, any pending RLS PRC should be cancelled. Now using shutdownNow() to forcefully close the RLS channel.
2021-02-08 15:52:53 -08:00
ZHANG Dapeng 9bb9fef6b0
rls: use channel creds to create resolvingOobChannel 2021-01-29 09:29:39 -08:00
Chengyuan Zhang b66d182bb9
api: delete LoadBalancer.Helper APIs that had been deprecated for a long time (#7793) 2021-01-11 15:25:35 -08:00
ZHANG Dapeng 7d77f64773
compiler: remove some of the static imports in codegen (#7751)
Resolves #7741 
Some of the static methods in generated code have the same method name but different package name, such `ClientCalls.asyncClientStreamingCall` and `ServerCalls.asyncClientStreamingCall`. It's less readable using static import than using full-qualified method name in-place.
2020-12-23 11:28:03 -08:00
ZHANG Dapeng 821ec65f2e
rls: cleanup and minor enhancement for rls logging
Cleanup `toString()` for cache entries, and print more debug information about cache entry when `pickSubchannel()`. This will be more helpful to debug.
2020-12-11 11:45:33 -08:00
ZHANG Dapeng 5111eca71b
rls: remove redundant request field in CachedRouteLookupResponse 2020-10-28 17:24:23 -07:00
ZHANG Dapeng b8257d6f06
rls: fix RPC hanging if lookup request fails (#7511) 2020-10-13 22:42:34 -07:00
ZHANG Dapeng cc5403c4c9
rls: allow defaultTarget in RouteLookupConfig unset
The `default_target` field can be unset per the [spec](http://go/grpc-rls-lb-policy-design)

Also fixed a synchronization bug (related to #7460) that `createOrGet()` should be guarded by lock.
2020-10-07 15:36:57 -07:00
ZHANG Dapeng f59cd0a599
rls: add logging for rls lb 2020-10-07 15:36:14 -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
ZHANG Dapeng e4c3de6334
rls: fix RLS_DATA_KEY propagation in headers 2020-09-28 09:56:01 -07:00
Chengyuan Zhang eb6110cefc
rls, xds: fix parameter comments that do not match the formal parameter name (#7319) 2020-08-12 09:50:54 -07:00
Eric Anderson e92b2275f9 Update to Error Prone 2.4
Most of the changes should be semi-clear why they were made. However, BadImport
may not be as obvious: https://errorprone.info/bugpattern/BadImport . That
impacted classes named Type, Entry, and Factory. Also
PublicContructorForAbstractClass:
https://errorprone.info/bugpattern/PublicConstructorForAbstractClass

The JdkObsolete issue is already resolved but is not yet in a release.
2020-08-06 10:56:16 -05:00
Jihun Cho b8822e56af
rls: OobChannel doesn't use directpath by default (#7176) 2020-07-01 12:02:49 -07:00
Jihun Cho 0f1631c7a3
rls: use system property to use direct path for oob channel (#7142) 2020-06-19 09:44:57 -07:00
Jihun Cho 8ab01c1fe6
rls: request factory prepends leading '/' (#7141) 2020-06-18 17:12:19 -07:00
Jihun Cho 4a80b42118
rls: update proto (#7046) 2020-05-15 12:27:05 -07:00
Jihun Cho e7d6b5f808
rls: add bazel build (#7019) 2020-05-07 17:59:47 -07:00
Jihun Cho 6cde3b220b
all: fix lint warnings (#7016) 2020-05-07 15:43:53 -07:00
Jihun Cho 73d35e336e
rls: add internal api to provide default cachnig client builder for testing (#7014) 2020-05-06 14:11:22 -07:00
Jihun Cho e62148f85d
rls: remove internal package (#7013) 2020-05-06 11:21:21 -07:00
Jihun Cho 0057c4f29d
rls: temporarily disable lb test until fixed (#7011) 2020-05-05 18:05:23 -07:00
Jihun Cho 86fc047966
rls: add internal package description (#7009) 2020-05-05 17:06:12 -07:00
Jihun Cho 8b914ee114
rls: add guava dependency (#7008) 2020-05-05 13:53:08 -07:00
Jihun Cho 8e8477704a
rls: generate rls coverage (#7004) 2020-05-05 10:11:33 -07:00
Jihun Cho 0515b8bed3
rls: fix resize, add some tests (#7005) 2020-05-05 10:11:12 -07:00
Jihun Cho f40af886e9
rls: add rls-exprimnetal LoadBalancer (#6998) 2020-05-04 18:05:19 -07:00
ZHANG Dapeng 0044f8ce56
all: migrate gradle build to java-library plugin
- Use gradle configuration `api` for dependencies that are part of grpc public api signatures.
- Replace deprecated gradle configurations `compile`, `testCompile`, `runtime` and `testRuntime`.
- With minimal change in dependencies: If we need dep X and Y to compile our code, and if X transitively depends on Y, then our build would still pass even if we only include X as `compile`/`implementation` dependency for our project. Ideally we should include both X and Y explicitly as `implementation` dependency for our project, but in this PR we don't add the missing Y if it is previously missing.
2020-05-04 16:44:30 -07:00
Jihun Cho 50a829ad9d
rls: caching rls client (#6966) 2020-05-01 12:02:05 -07:00
Jihun Cho 4a644cb876
rls: fake direct scheduled executor supports schedule (#6957) 2020-04-22 12:04:26 -07:00
Jihun Cho 459cbc7b44
rls: add interface to ResolvedAddressFactory (#6958) 2020-04-21 19:12:32 -07:00
Jihun Cho 23bcdb1a09
rls: lb policy config object (#6883) 2020-04-20 23:04:17 -07:00
Jihun Cho 050679bdf3
rls: child lb resolved address factory (#6886) 2020-04-13 10:46:19 -07:00
Jihun Cho 1a1583de52
rls: delegating helper for rls child policies (#6904) 2020-04-11 00:20:18 -07:00
Jihun Cho 1686d703e6
rls: rls request factory (aka key builder map) (#6823) 2020-04-10 15:56:40 -07:00
Jihun Cho 4974b51c53
rls: LruCache interface and implementation (#6799) 2020-04-10 10:52:13 -07:00
Jihun Cho 58a92b7530
rls: subchannel state manager (#6882) 2020-04-06 17:33:39 -07:00
Jihun Cho b72477e282
rls: fix RlcProto parsing issues (#6822) 2020-03-12 18:46:05 -07:00
Jihun Cho a680c982f5
rls: adaptive throttler (#6749) 2020-03-12 18:45:36 -07:00
Jihun Cho 0fd4975d4c
rls: add proto and converter (#6743) 2020-02-28 21:41:19 -08:00