Commit Graph

1315 Commits

Author SHA1 Message Date
Eric Anderson 0eefa5263b inprocess: Add maxInboundMetadataSize 2018-10-18 14:34:03 -07:00
Eric Anderson 0fbc1153bd testing: Add transport tests for maxInboundMetadataSize 2018-10-18 14:34:03 -07:00
Jihun Cho b7dc501bbe core: For Android, ignores DNS cache
There is a known issue that causes DNS lookup issue when network
siwtchover on android. This issue is tracked separately in #4962.
This change simply disables DNS cache to avoid the issue on Android.
2018-10-17 22:51:43 -07:00
Jihun Cho 0a7fa14042 core: Roll forward "core: DnsNameResolver caches refresh (#4812)"
This reverts commit 0e8cf58d1a.
2018-10-17 22:51:43 -07:00
Carl Mastrangelo c729a0f76b
core: enable SRV records lookup 2018-10-16 10:10:08 -07:00
Kun Zhang 6adc1797c9
core: finalize convenient overrides on LoadBalancer.Helper and Subchannel. (#4954)
Those overrides are kept for backward compatibility and convenience
for callers.  Documentation already says implementations should not
override them.  Making them final reduces confusion around which
override should be verified in tests and be overridden in forwarding
classes, thus prevents bugs caused by such confusion.
2018-10-16 09:43:58 -07:00
Carl Mastrangelo 60b02c0b9c
core: throw exception on resolution failure and no jndi resolver 2018-10-15 16:59:02 -07:00
Kun Zhang c528df8ae8
core: add internal Subchannel.asChannel() (#4950)
Returns a Channel that allows a LoadBalancer to make auxiliary RPCs on already-established application connections. We need this to implement client-side health-checking (#4932)

See comments on the API for its semantics.

Notable changes:

- Transports are modified to use InUseStateAggregator so that they can exclude RPCs made on Subchannel.asChannel() when reporting in-use state for idle mode.
- OobChannel shares the same Executor as Subchannel.asChannel(). Because the latter is not a ManagedChannel and doesn't have life-cycle, thus can't determine when to return the Executor to a pool, the Executor is now returned only when ManagedChannelImpl is terminated.
2018-10-15 15:39:21 -07:00
Kun Zhang ef8a84421d
core: promote CallCredentials API v2. (#4952)
This is Step 3 of #4901.  The old interface has been deprecated in the
latest release.  Now it's time to replace it with the new API.
2018-10-15 15:37:20 -07:00
Carl Mastrangelo 6b7c8694a9
core: make DnsNameResolver Error on empty addresses
This change does 3 main things (in 3 commits):

1.  Refactor the resolution runnable to be testable
2.  Add Finer level logging to aid in debugging
3.  Check that there are addresses before passing them to ManagedChannelImpl.
2018-10-12 18:11:45 -07:00
ZHANG Dapeng 595e5acfd1
core: temporarily disable census when enableRetry 2018-10-12 16:42:51 -07:00
Jihun Cho 2ce6ddfb5c core: removed unused expression 2018-10-12 16:18:03 -07:00
Jihun Cho 0e8cf58d1a Revert "core: DnsNameResolver caches refresh (#4812)"
This reverts commit 189991012b.
2018-10-12 15:30:38 -07:00
Jihun Cho c24f2fd25b Revert "core: android use smaller(2s) DNS cache TTL (#4943)"
This reverts commit ecb206f277.
2018-10-12 15:30:38 -07:00
creamsoup ecb206f277
core: android use smaller(2s) DNS cache TTL (#4943)
android use smaller (2s) DNS cache TTL
2018-10-12 13:56:49 -07:00
Carl Mastrangelo d06c8e3bf7
core: include what name resolver was used when it fails 2018-10-11 13:39:20 -07:00
Eric Anderson 967cc64770 Start 1.17.0 development cycle 2018-10-11 09:29:23 -07:00
Kun Zhang 861f9147ed
core: add CallCredentials2 and deprecate CallCredentials' old interface (#4902)
This is the first step of smoothly changing the CallCredentials API.

Security level and authority are parameters required to be passed to
applyRequestMetadata(). This change wraps them, along with
MethodDescriptor and the transport attributes to RequestInfo, which is
more clear to the implementers.

ATTR_SECURITY_LEVEL is moved to the internal GrpcAttributes and
annotated as TransportAttr, because transports are required to set it,
but no user is actually reading them from
{Client,Server}Call.getAttributes().

ATTR_AUTHORITY is removed, because no transport is overriding it.

All involved interfaces are changed to abstract classes, as this will
make further API changes smoother.

The CallCredentials name is stabilized, thus we first introduce
CallCredentials2, ask CallCredentials implementations to migrate to
it, while GRPC accepting both at the same time, then replace
CallCredentials with CallCredentials2.
2018-10-10 21:45:56 -07:00
Kun Zhang cc5e3c19df
core: ForwardingLoadBalancerHelper (#4911)
This will be used by LoadBalancer plugins that delegates to another,
which is what the new request routing (go/grpc-request-routing-design)
requires.  This will also be used to wrap LoadBalancers to add
client-side health-checking functionality.
2018-10-06 12:36:35 -07:00
Kun Zhang fbfc3a40d0
core: add Grpc.TRANSPORT_ATTR_LOCAL_ADDR (#4906)
Resolves #4135
2018-10-03 16:43:37 -07:00
Carl Mastrangelo 6b7fa40378
core: name anonymous classes in ManagedChannel for clear stacktraces 2018-10-03 14:09:00 -07:00
Kun Zhang ebbf8005be
doc: organize Attributes with annotations. (#4892)
* doc: organize Attributes Keys with annotations.

Keys are annotated with the following annotations:

1. Grpc.TransportAttr: transport attributes returned by
{Client,Server}Call.getAttributes().

2. NameResolver.ResolutionResultAttr: attributes passed as the
argument of NameResolver.Listener.onAddresses() and
LoadBalancer.handleResolvedAddressGroups()

3. EquivalentAddressGroup.Attr: attributes from
EquivalentAddressGroups.

* Expand the usage of annotations to Attributes variables.
2018-10-01 10:11:01 -07:00
zpencer 2fae9a3a97
core: permanently store authority at channel creation (#4886)
Getting the authority must not rely on the name resolver being
non-null, because that can trivially happen if the channel is shut
down.
2018-09-28 16:10:14 -07:00
Jesse Wilson 8b16899bc1 Upgrade to Guava 26.0-android and jsr305 3.0.2 2018-09-28 13:23:55 -07:00
zpencer da87ffb329
core,services: v1 binlog (#4846)
Log using new proto definition

- Remove io.grpc.BinaryLog.CallId because a call ID is now an AtomicLong
- Add the concept of "always included" and "never included" metadata
  keys. This is needed because grpc-status-details-bin is already
  logged in the binlog msg, and we will log grpc-trace-bin for the
  census info.
- unit tests are effectively rewritten
2018-09-27 13:19:24 -07:00
Spencer Fang cc09eab9af core: fix channelz import on AutoConfiguredLoadBalancerFactory
The original PR was stale when merged.
2018-09-19 14:32:16 -07:00
ZHANG Dapeng 0afc10c2d6
core: channel tracing to log lb policy changes 2018-09-19 11:36:33 -07:00
Carl Mastrangelo b0f423295b
all: use Java7 brackets 2018-09-14 13:52:29 -07:00
Nick Hill ed709ff9ff core: remove redundant SubchannelPicker refreshes in RoundRobinLoadBalancer
* Remove redundant SubchannelPicker refreshes in RoundRobinLoadBalancer

- Ensure active subchannel list and round-robin index is only
regenerated/refreshed when it changes
- Make it so that Subchannels exist in subchannels map iff their state
!= SHUTDOWN
- Add EmptyPicker class since logic for this case is disjoint from the
non-empty case

* remove explicit initialization of boolean ready field

per @carl-mastrangelo's review comment

* minor restructuring to make logic clearer; more explanatory comments

* move some checks inside updateBalancingState method for clarity

* store current state and picker in RRLB, only update when new one is diff

* some more simplification/refactoring; improve test coverage

- remove now redundant check in handleSubchannelState

- collapse getAggregatedState() and getAggregatedError() into
handleBalancingState()

- have both pickers extend new RoundRobinPicker, move
areEquivalentPickers() logic into RoundRobinPicker.isEquivalentTo()

- extend unit tests to cover some additional cases

* Address latest review comments from @zhangkun83

- Use explicit check for non-empty list instead of assert
- Change EmptyPicker.status to be non-nullable
- Further test coverage improvement including explicit picker comparison
tests

* use EMPTY_OK instead of Status.OK for initial empty picker
2018-09-12 15:06:46 -07:00
ZHANG Dapeng c8975e987b
all: fix lint warnings in import 2018-09-11 16:24:44 -07:00
zpencer 95fd47d747
core, services: remove census from binary logs (#4845)
The exact census span behavior wrt gRPC is not yet defined, so let's
punt on tight integration.

It may be fine to log grpc-trace-bin on server side because it is a
key visible to the application.
2018-09-10 16:35:08 -07:00
creamsoup 189991012b
core: DnsNameResolver caches refresh (#4812)
DnsNameResolver caches refresh using java security property networkaddress.cache.ttl.

Resolves #4745
2018-09-06 16:58:34 -07:00
zpencer 2fca42feb9
all: prepend internal classes with Internal (#4826)
This is a safer way to hide the classes, because they will not appear
in public targets for some build configurations.
2018-09-05 18:48:42 -07:00
zpencer 4d366ce978
all: move Channelz to io.grpc as InternalChannelz (#4797)
This is an API used to coordinate across packages and must live in
`io.grpc`.

Prepending `Internal` makes it easier to detect and hide this class
from public visibility when using certain build tools.

fixes #4796
2018-09-04 16:52:01 -07:00
creamsoup bbacd164f9
skip populating trace header if no census impl is available. (#4805) 2018-08-30 14:45:11 -07:00
ZHANG Dapeng 6037659dd7
core: make HedgingPolicy final
Just as RetryPolicy is final.
2018-08-28 17:09:05 -07:00
Eric Gribkoff 67ee4b6a8f
core: switch to Java 7 source and bytecode (#4801)
javac can produce code that invokes Object.requireNonNull when instantiating
an inner class using a instance variable. See
https://bugs.openjdk.java.net/browse/JDK-8202137
2018-08-27 20:48:57 -07:00
Kun Zhang 28d44ae46d
Start 1.16.0 development cycle (#4803) 2018-08-27 17:21:46 -07:00
Eric Anderson 7b126b00a0 all: Swap to Java 7 source and bytecode
Core and OkHttp are left with Java 6 for the moment. Once we resolve
their issues they could be bumped as well.

Updates #3961
2018-08-27 15:29:03 -07:00
ZHANG Dapeng e9b6568450
core: plumb hedging policy
This is only API plumbing for hedging, following exactly the same way as its retry counterpart, so it is almost trivial.
2018-08-23 14:38:10 -07:00
Carl Mastrangelo 3f05a6e331
core: minor cleanup of NameResolverProvider
* Make the list of providers an immutable List
* Make obvious that the list is statically initialized
* Add documentation for when methods were added.
* Use RuntimeException, rather than IllegalStateException.
2018-08-20 12:59:55 -07:00
Carl Mastrangelo 7fe49f9b52
core: add ability to create stackless status exceptions 2018-08-17 11:40:11 -07:00
zpencer a48b090dc6
core: Handle null ProxySelector (#4762)
ProxySelector.getDefault() can return null

Fixes #4677
2018-08-16 15:04:33 -07:00
creamsoup ba4db45e71 Fix errror message when DNS name is invalid. (#4751)
It used to throw NPE, since URI.create creates URI with null hostname. Now it
thorws IllegalArgumentException for invalid DNS name, NPE for null name.
2018-08-13 16:55:20 -07:00
Eric Anderson 3cfc5af4f1 core: Avoid implicit requestConnection in PickFirst
This makes the behavior more clear.
2018-08-13 09:41:06 -07:00
Spencer Fang 9f477b27bb core: fix unused variable lint 2018-08-09 13:31:23 -07:00
Eric Gribkoff 79b24709b9
all: update animalsniffer to Java 7 and add Android 14 (#4727) 2018-08-09 09:09:21 -07:00
Carl Mastrangelo 67352081f8
core: revert warning about `Status.asException(null)`
There seem to be some users converting from StatusRuntimeException
to StatusException using the following paradigm:

sre.getStatus().toException(sre.getTrailers())

Since there isn't a viable alternative, revert the warning.
2018-08-06 11:44:52 -07:00
Kun Zhang 2aa02fd869
core: remove unused fullMethodName field from CensusStatsModule. (#4731) 2018-08-03 09:16:29 -07:00
Carl Mastrangelo 9895e243b1
inprocess: prevent null names, and define socket address equality 2018-08-02 17:28:36 -07:00