Commit Graph

765 Commits

Author SHA1 Message Date
Carl Mastrangelo cbe0ecd5e2 all: fix linter found on import 2017-01-27 15:47:53 -08:00
Carl Mastrangelo 566d0e9400 testing: change names of noopMarshaller to void marshaller
This is needed because in interceptor tests, often the types cannot
be changed.  The void methods stay for users who are writing tests
where they actually don't care about types.  The noop methods
require types to be specified.  This is for users who don't care
about the implementation.  These represent different levels of
commitment.

This eases the transition of code Mocking MethodDescriptor, which
breaks in this release.
2017-01-27 14:41:38 -08:00
Kun Zhang 9983a7b9e4 docs: security requirement of NameResolver.getServiceAuthority() (#2665)
In response to #2662
2017-01-27 09:27:47 -08:00
Eric Anderson 65e4d9f47a all: avoid DNS with GRPC_PROXY_EXP
In some environments DNS is not available and is performed by the
CONNECT proxy. Nothing "special" should need to be done for these
environments, but the previous support took shortcuts which knowingly
would not support such environments.

This change should fix both OkHttp and Netty. Netty's
Bootstrap.connect() resolved the name immediately whereas using
ChannelPipeline.connect() waits until the address reaches the end of the
pipeline. Netty uses NetUtil.toSocketAddressString() to get the name of
the address, which uses InetSocketAddress.getHostString() when
available.

OkHttp is still using InetSocketAddress.getHostName() which may issue
reverse DNS lookups. However, if the reverse DNS lookup fails, it should
convert the IP to a textual string like getHostString(). So as long as
the reverse DNS maps to the same machine as the IP, there should only be
performance concerns, not correctness issues. Since the DnsNameResolver
is creating unresolved addresses, the reverse DNS lookups shouldn't
occur in the common case.
2017-01-27 09:27:07 -08:00
Kun Zhang 0e6cf9971b core: open up LBv2 APIs for early adopters. 2017-01-26 16:27:31 -08:00
Carl Mastrangelo 89bc2cd3b2 all: update to latest import ordering 2017-01-26 13:43:06 -08:00
Kun Zhang 0428556ce4 core: allow LBv2 impls to be stripped out by ProGuard. (#2654)
This should address the concern of increased method count as mentioned
in #2650.
2017-01-25 15:06:39 -08:00
Kun Zhang f088b81fc8 core: stop "testing" from depending on "core"'s test. (#2652)
Because "core"'s test source already depends on "testing", e.g.,
`core/src/test/java/io/grpc/internal/ServerCallImplTest.java` uses
`testing/src/main/java/io/grpc/internal/testing/StatsTestUtils.java`,
which forms a circular dependency.

This change moves the StatsContext setter accessors from "core"'s test
source to "testing".

Resolves #2651
2017-01-25 07:57:12 -08:00
dapengzhang0 7d85e73b23 ForwardingClientCall.getAttributes should call delegate 2017-01-24 09:11:23 -08:00
Carl Mastrangelo 40bc50212b core: remove with* methods from MethodDescriptor 2017-01-23 15:41:40 -08:00
Lukasz Strzalkowski b33d3cb170 core: rename getAttr() and use standard getAttributes() 2017-01-23 15:06:00 -08:00
Łukasz Strzałkowski 8882abaa09 core: rename attributes() -> getAttributes()
Make it consistent with its counterpart, ClientStream#getAttributes()
2017-01-23 15:04:51 -08:00
Carl Mastrangelo efbcd1f1b9 core: change method descriptor to be builder based 2017-01-23 12:29:35 -08:00
Eric Anderson e9fa8c99ce core: Only use scheduled executor for timer tasks
This removes an abuse of scheduled executor in ManagedChannelImpl. The executor
was used to avoid deadlocking. Now we run the work on the same thread, but
delay it until locks have been released.

There is no need to fix ManagedChannelImpl2. Due to its different
threading model it didn't have need to abuse the scheduledExecutor.

Fixes #2444
2017-01-23 11:24:25 -08:00
Carl Mastrangelo a4e481b3f9 core: make ServiceDescriptor check input values
Fixes: #2357
2017-01-20 17:22:14 -08:00
Kun Zhang 737cd16a38 core: make StatsContextFactory setters protected (#2634)
These are only used in internal tests.  In production,
StatsContextFactory is loaded by the "Instrumentation" library and must
be one per process, thus we won't allow setting it on a per-channel or
per-server basis.
2017-01-20 17:20:44 -08:00
ZHANG Dapeng 018e2d5307 all: make some api non-experimental for 1.1 2017-01-20 16:34:56 -08:00
Eric Anderson 2bd74c5a92 core: cancel RPC when exception in server onReady
Fixes #2305
2017-01-20 10:47:11 -08:00
Carl Mastrangelo d5eb248737 all: bump to netty 4.1.7 2017-01-19 15:24:26 -08:00
Lukasz Strzalkowski 060eb45623 Rename attributes() to getAttributes() to make it consistent 2017-01-19 12:53:54 -08:00
Eric Anderson 1e99b299e1 all: ErrorProne fixes and avoid @Beta in Guava 2017-01-19 12:16:05 -08:00
Kun Zhang 5a4794f2c8 core: add debug information in MessageDeframer. (#2622)
So that MessageDeframer would include the class name of the enclosing
stream when emitting errors.  This should give us more information about #2157
2017-01-18 17:23:29 -08:00
Kun Zhang fa8f1150cb docs: fix deprecation reference in ClientAuthInterceptor. (#2621) 2017-01-18 16:25:57 -08:00
Łukasz Strzałkowski 6494a17c5b RoundRobinLoadBalancer minor cleanups (#2611)
* Remove else, make it easier to read

* Ready subchanns list will be at max the same as the input list

* Make status private, add pkg-private getter for tests

* Remove empty field, cache size, simplify logic

Make list unmodifiable. Document index with GuardedBy (see #nextSubchannel())
2017-01-18 14:40:30 -08:00
ZHANG Dapeng d87a6587a4 core,netty: add getAttributes to ClientStream and ClientCall (#2526)
add `getAttributes()` to `ClientStream` and `ClientCall` to be able to share clientTransport
information such as socket TOS with higher lever API's, once the RPC picks up an active transport that is ready to use.
2017-01-17 20:33:37 -08:00
Kun Zhang 527d243ec0 core: more logs in ManagedChannelImpl. (#2606)
They have already been added to ManagedChannelImpl2.

Resolves #2299
2017-01-17 09:36:02 -08:00
Eric Gribkoff d59973c925 core,services: separately index mutable and immutable services
Updates the proto reflection service to process immutable services once and
mutable services as-needed.
2017-01-13 17:46:56 -08:00
Kun Zhang c436d93f07 core: ServerImpl returns shared resources at termination (#2605)
Previously it does it at shutdown, which was wrong because executor may
still be used before the server is terminated.

Resolves #2034

Uses ObjectPool to make this change testable.  Cleans up test and makes
it mostly single-threaded, except for two deadlock tests that have to be
multi-threaded.
2017-01-13 09:00:32 -08:00
Carl Mastrangelo ec7f00a272 core,testing: make MethodDescriptor final and add Test helper 2017-01-11 17:30:14 -08:00
Carl Mastrangelo ce3a94bacc core: promote experimental methods in MethodDescriptor 2017-01-11 17:07:53 -08:00
Carl Mastrangelo b5b9ba5604 core: fix bug with Metadata merging 2017-01-11 13:23:46 -08:00
Carl Mastrangelo 8493498a54 core: remove thisT() from API 2017-01-11 12:46:47 -08:00
Carl Mastrangelo 813cb090af core: make getResponseMarshaller experimental in MethodDescriptor 2017-01-11 11:22:01 -08:00
Carl Mastrangelo 85bb0a100d core: make Contexts, ResolvedServerInfoGroup, and ServerInterceptors final 2017-01-11 10:47:17 -08:00
Carl Mastrangelo 8e463ce1a8 core,stub: remove deprecated deadline methods 2017-01-10 15:54:38 -08:00
Kun Zhang d17a7b5bd4 core: abstract channel builder to accept LoadBalancer2 (#2583)
If a LoadBalancer2 is passed in, the builder will create ManagedChannelImpl2 instead of ManagedChannelImpl. This allows us to test the LBv2 classes on a large scale.
2017-01-10 15:30:12 -08:00
Kun Zhang 7cb0497767 core: ManagedChannelImpl2. (#2530)
1. Adapt to LoadBalancer2 interface.  Channel holds on to a single
   DelayedClientTransport2.

2. Lock-free: every channel state mutation, including Subchannel
   mutations, calling into LoadBalancer, idleness and shutdown, is made
   from channelExecutor.

3. Idleness grace period is no longer needed.
2017-01-09 14:44:10 -08:00
Carl Mastrangelo 8d49df28ee all: add max message size to client calls 2017-01-05 17:23:34 -08:00
Carl Mastrangelo 6ed3cbb143 core: fix API breakage in ServerBuilder 2017-01-05 17:22:47 -08:00
Kun Zhang cce8eac56d core: upgrade census (now named instrumentation) to 0.3.0 (#2565)
In upstream, Census is renamed to "Instrumentation". `com.google.census` is renamed to `com.google.instrumentation.stats`.

In gRPC, "census" in every name is replaced by "stats".
2017-01-05 10:48:13 -08:00
Kun Zhang 322eb8c5c5 grpclb: re-implement GrpclbLoadBalancer in v2 API. (#2557)
Besides API changes, this implementation is also up-to-date with the
latest design:

1. Delegate to round-robin and pick-first policies if requested by
the naming system.

2. OOB channels to LoadBalancer always use the LB authority provided by
the naming system.

3. Never send application RPCs to balancer addresses, even if the
address returns UNIMPLEMENTED error.
2016-12-29 15:00:04 -08:00
Kun Zhang 4693492fda style: fix styles and error-prones (#2560)
"Because of spurious wakeups, wait() must always be called in a loop".
Got rid of wait().

"If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead."
Ignored the exception thrown from finally.
2016-12-29 11:20:49 -08:00
Łukasz Strzałkowski 661413c2df core: Port PickFirst & RoundRobin LBs to v2 API (#2479) 2016-12-21 10:03:25 -08:00
Kun Zhang a6ecece6f5 doc: more guidelines for LoadBalancer2 implementations. (#2501) 2016-12-16 15:18:59 -08:00
Carl Mastrangelo ce9d152dff all: update to guava 20 2016-12-16 15:15:17 -08:00
Kun Zhang f8f569e078 core: InternalSubchannel uses ChannelExecutor. (#2503) 2016-12-16 14:17:38 -08:00
Kun Zhang 1ba66d38d9 doc: update javadocs in DelayedClientTransport2. (#2522)
Resolves #2521
2016-12-15 13:07:19 -08:00
Carl Mastrangelo f394a93ddb core: add full stack trace in Status.toString
* core: add full stack trace in Status.toString
2016-12-15 08:54:56 -08:00
Kun Zhang 946046abaf core: two changes on DelayedClientTransport2. (#2505)
1. Use ChannelExecutor to run callbacks.  Now callbacks are no longer
run under the delayed transport lock.

2. Use explicit picker version instead of relying on identity equality
to detect new pickers.  Rationale: if reprocess() is called again with
the same picker, all pending streams will be reprocessed by this picker
again, thus there is no reason to leave out the racing new stream.
2016-12-15 08:47:33 -08:00
Anuraag Agrawal 221fadcbdd Implement setListener in AbstractServerStream and remove from subclasses. 2016-12-14 12:29:10 -08:00