Commit Graph

780 Commits

Author SHA1 Message Date
Kun Zhang a9bd94781c core: promote LBv2 classes. 2017-02-24 16:48:44 -08:00
Kun Zhang a6b1d8981a core: delete the old channel impl and LoadBalancer. 2017-02-24 16:48:44 -08:00
Eric Anderson 675080b208 all: Enable ErrorProne during compilation
ErrorProne provides static analysis for common issues, including
misused variables GuardedBy locks.

This increases build time by 60% for parallel builds and 30% for
non-parallel, so I've provided a way to disable the check. It is on by
default though and will be run in our CI environments.
2017-02-24 14:53:23 -08:00
Łukasz Strzałkowski 70b482afad core: clean up code deprecated in 1.1 (#2678) 2017-02-21 14:20:26 -08:00
Łukasz Strzałkowski 63a77658fb Fix link to class in java doc (#2739)
doc: fix link to class in java doc
2017-02-21 09:48:25 -08:00
Kun Zhang 6ff5f2149b core: report error count metrics. (#2734) 2017-02-17 14:07:37 -08:00
Eric Anderson 72923dca87 all: prepare for ErrorProne's FutureReturnValueIgnored
Futures almost universally should be handled in some way when being
returned, either to receive the value or to cancel scheduled tasks to
prevent leaks.

Netty is a bit of a special case though, since it constantly returns
futures that you ignore (even adding a listener returns the "this"
future). So we want to suppress the warning for code using Netty instead
of trying to fix it. When we enable ErrorProne in the build, we should
start passing -Xep:FutureReturnValueIgnored:OFF in the compilerArgs.
2017-02-16 07:22:56 -08:00
Ryan Michela 4029b3f0c2 Implement missing authority API for HandlerRegistry 2017-02-10 17:19:20 -08:00
ZHANG Dapeng 9c78b466b6 core: DelayedStream getAttributes to throw IllegalStateExeption if not passThrough 2017-02-10 11:13:10 -08:00
Eric Anderson 7e1fd4f370 core: Tweak getAttributes() JavaDoc
It now provides more guarantees and should be more obvious when it is
safe to use.
2017-02-08 12:49:00 -08:00
Kun Zhang 9a81cad952 core: switch to LBv2 as the default. (#2707) 2017-02-07 17:45:28 -08:00
Eric Anderson 42aa64c647 all: swap to newer animalsniffer plugin
The new plugin uses a newer version of animalsniffer, allows overriding
the animalsniffer version used, and has up-to-date handling. The
up-to-date handling cuts fully incremental parallel build times in half,
from 5.5s to 2.7s.

The previous plugin was supposed to be verifying tests. However, either
it wasn't verifying them or its verification was broken.
2017-02-07 12:49:01 -08:00
Kun Zhang 45642096c3 core: un-abstract the LBv2 setter in ManagedChannelBuilder. (#2697)
The LBv2 setter was added in #2658 as an abstract method, which breaks
anyone who implements ManagedChannelBuilder.  Here we add a default
implementation that throws.
2017-02-06 13:26:47 -08:00
Kun Zhang 7ab5e0e810 core: record server_elapsed_time on client (#2673)
It is defined as the time between the client sends out the headers, and the RPC finishes.
2017-02-03 13:29:06 -08:00
Carl Mastrangelo 237a65ebfc core: make ServiceDescriptor use the Builder pattern 2017-01-30 15:22:40 -08:00
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