Commit Graph

28 Commits

Author SHA1 Message Date
Eric Anderson b6720c9fe6 api: Don't yet deprecate NameResolver.Listener
We think NameResolver.Listener2 may still change, so don't yet encourage
people to migrate.

Fixes #5764
2019-05-21 17:49:08 -07:00
Eric Anderson 15a453d9ef api: Fix doc for default value of idleTimeout()
It appears the docs were not updated when this was changed in d74091f5, which
was first released in v1.1.
2019-05-21 13:48:57 -07:00
Kun Zhang a2595d9e7d
api/core/grpclb: add warning about calling Subchannel.requestConnection() outside of sync-context (#5757)
The pick_first policies in core and grpclb previously would call
Subchannel.requestConnection() from data-path.  They now will schedule
that call in the sync-context to avoid the warning.  They will only
call it for the first pick of each picker, to prevent storming the
sync-context.
2019-05-20 11:39:02 -07:00
Kun Zhang 7934594dfe
api: pass Subchannel state updates to SubchannelStateListener rather than LoadBalancer (take 2) (#5722)
This is a revised version of #5503 (62b03fd), which was rolled back in f8d0868. The newer version passes SubchannelStateListener to Subchannel.start() instead of SubchannelCreationArgs, which allows us to remove the Subchannel argument from the listener, which works as a solution for #5676.

LoadBalancers that call the old createSubchannel() will get start() implicitly called with a listener that passes updates to the deprecated LoadBalancer.handleSubchannelState(). Those who call the new createSubchannel() will have to call start() explicitly.

GRPCLB code is still using the old API, because it's a pain to migrate the SubchannelPool to the new API.  Since CachedSubchannelHelper is on the way, it's easier to switch to it when it's ready. Keeping
GRPCLB with the old API would also confirm the backward compatibility.
2019-05-17 16:37:41 -07:00
Kun Zhang ae14c8d061
api: temporarily remove the warning about sync-context in requestConnection(). (#5738) (#5752)
Contrary to #5736, we will still keep the sync-context requirement of
requestConnection(), because it prevents API fragmentation.
PickFirstLoadBalancer is the only known violator.  We will fix it on
master, but we don't want to make that change on 1.21.x because the
release is soon.  We simply remove the warning in this release so that
users won't be annoyed.

This supersedes #5736
2019-05-16 13:07:10 -07:00
Kun Zhang cec9ee368d
api: move SubchannelPicker.requestConnection() to LoadBalancer. (#5751)
We will require Subchannel.requestConnection() to be called from
sync-context (#5722), but SubchannelPicker.requestConnection() is
currently calling it with the assumption of thread-safety.  Actually
SubchannelPicker.requestConnection() is called already from
sync-context by ChannelImpl, it makes more sense to move this method
to LoadBalancer where all other methods are sync-context'ed, rather than
making SubchannelPicker.requestConnection() sync-context'ed and fragmenting
the SubchannelPicker API because pickSubchannel() is thread-safe.

C++ also has the requestConnection() equivalent on their LoadBalancer
interface.
2019-05-16 09:50:23 -07:00
Kun Zhang 0c17c4c995
api: make LoadBalancer.Helper and Subchannel further non-thread-safe. (#5718)
I see more cases of wrapping Helper and Subchannel during the work of
XdsLoadBalancer, we will require that all methods that involve mutable
state to be called from the Synchronization Context.  We will start
logging warnings first, and make them throw in a future release.

Helper.createSubchannel() is already doing so.  This change adds
warnings to the other eligible methods.

https://github.com/grpc/grpc-java/issues/5015
2019-05-09 18:13:46 -07:00
Kun Zhang 175a423c10
api: add getters for NameResolver.Args and NameResolverRegistry in LoadBalancer.Helper (#5685)
Hierarchical LoadBalancers such as xDS will need this to create NameResolvers to resolve locality target names.
2019-05-09 15:55:18 -07:00
Eric Anderson 980dd9671d api: Rename NameResolver.Observer to Listener2
This follows the sort of changes we've done in the past, where the '2'
implies "version 2." We can end up reclaiming the original name if we
wish in the future.

The main reason for this change is to avoid changing to Observer since
the rest of io.grpc consistently uses Listener.
2019-05-08 20:00:35 -07:00
Kun Zhang f8d0868e1d
Revert "core: pass Subchannel state updates to SubchannelStateListener rather than LoadBalancer (#5503)" (#5684)
This reverts commit 62b03fd7e6.

Effectively reverts its follow-up commits:
dc218b6d4d
405d8c3865
44840fe813
2019-05-08 09:01:45 -07:00
Eric Anderson 257bb546fd api: Discourage using ClientInterceptor for credentials 2019-05-06 17:03:44 -07:00
ZHANG Dapeng 72553433b3
api: fix LoadBalancer javadoc links 2019-05-06 11:17:35 -07:00
Kun Zhang 63f636b4b6
api: NameResolver.Args deprecates NameResolver.Helper. (#5664)
Having two Helpers (the other being LoadBalancer.Helper) is proven to
be confusing, and the one in NameResolver is fundamentally different
from the one from LoadBalancer, as the latter mutates the states while
the former doesn't. Renaming it to Args make it less awkward to
expose it to LoadBalancer, which is needed for creating NameResolvers
for per-locality routing in the XdsLoadBalancer.
2019-05-03 16:45:38 -07:00
Kun Zhang 973885457f
core: change ClientStreamTracer.StreamInfo to a final class with a builder (#5648)
As we are now endorsing the wrapping of ClientStreamTracers by
providing ForwardingClientStreamTracer, there is a need for altering
StreamInfo, especially CallOptions before it's passed onto the
delegate.  A Builder class and a toBuilder() provides a robust way
to copy the rest of the fields.

This is a breaking change for anybody who creates StreamInfo, which is
unlikely in non-test code, because StreamInfo was added as late as
1.20.0.
2019-04-30 09:10:56 -07:00
Chengyuan Zhang 44840fe813
api: fix bugs of missing to copy customOptions when converting to a new builder, also trash hashCode/equals (#5647)
* api: fix bugs of missing out customOptions in CreateSubchannelArgs toBuider, hashCode, equals

* trash equals/hashCode for CreateSubchannelArgs as they are problematic
2019-04-29 18:40:11 -07:00
Chengyuan Zhang 405d8c3865
api: patch CreateSubchannelArgs toString() with customOptions (#5646) 2019-04-29 14:54:59 -07:00
Chengyuan Zhang dc218b6d4d
api: augment CreateSubchannelArgs with custom options (#5640)
* api: augment CreateSubchannelArgs with custom options

* added unit tests

* added ExperimentalApi anntation with tracking issue
2019-04-26 13:59:37 -07:00
Kun Zhang d530641097
core: annotate experimental API's inner classes. (#5643)
Annotations on outer class don't show on the javadoc of inner classes.
2019-04-26 11:28:48 -07:00
Carl Mastrangelo 53a3f12666
api: expose if waitForReady has been set on CallOptions 2019-04-25 10:56:40 -07:00
Carl Mastrangelo ce6358e57f
core: add getService to MethodDescriptor 2019-04-24 17:45:41 -07:00
Eric Anderson 187fe9e146 Lint fixes 2019-04-23 14:51:34 -07:00
Carl Mastrangelo 04e07034f3
all: update to truth 0.44 2019-04-23 10:50:49 -07:00
Eric Anderson f4d48fec62
core: Add NameResolverRegistry
NameResolverRegistry takes on all the logic previously in
NameResolverProvider. But it also allows manual registration of
NameResolvers, which is useful when the providers have complex
construction or need objects injected into them.

This also avoids a circular dependency during class loading since
previously loading any Provider searched for all Providers via
ClassLoader since ClassLoader handling was static within the parent
class.

Fixes #5562
2019-04-22 10:22:46 -07:00
Jean de Klerk b363f80764 docs: add note about retrying UNAVAILABLE 2019-04-19 14:29:13 -07:00
Eric Anderson 7c0e14318e api: Stabilize MethodDescriptor.Marshaller
Fixes #1777
2019-04-19 10:32:42 -07:00
Kun Zhang 39e66fa22b
core: delete ManagedChannelBuilder.loadBalancerFactory() and all deprecated factories (#5480)
This has been deprecated since 1.18.0
2019-04-17 14:46:19 -07:00
Carl Mastrangelo a395eec4a3
core: update LB and NR API names
Updates #1770
2019-04-17 12:45:29 -07:00
Eric Anderson 80c3c992a6 core: Move io.grpc to grpc-api
io.grpc has fewer dependencies than io.grpc.internal. Moving it to a
separate artifact lets users use the API without bringing in the deps.
If the library has an optional dependency on grpc, that can be quite
convenient.

We now version-pin both grpc-api and grpc-core, since both contain
internal APIs.

I had to change a few tests in grpc-api to avoid FakeClock. Moving
FakeClock to grpc-api was difficult because it uses
io.grpc.internal.TimeProvider, which can't be moved since it is a
production class. Having grpc-api's tests depend on grpc-core's test
classes would be weird and cause a circular dependincy. Having
grpc-api's tests depend on grpc-core is likely possible, but weird and
fairly unnecessary at this point. So instead I rewrote the tests to
avoid FakeClock.

Fixes #1447
2019-04-16 21:45:40 -07:00