Commit Graph

1818 Commits

Author SHA1 Message Date
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
ZHANG Dapeng 3d210ae875 compiler: reduce synchronzed invocation (#2539)
not necessary to synchronze every time calling
getServiceDescriptor(), if the descriptor has been created already;

go with the double-checked locking idom
2016-12-29 12:21: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
Kun Zhang 1aaf1a989c compiler: final bindService() in generated code. (#2553)
So that it won't be overridden by Mockito when it creates a mock for
the server interface.
2016-12-29 10:32:47 -08:00
Eric Anderson 09fd43df4e compiler: Use public headers instead of pb.h
Using the pb.h causes trouble when dealing with internal vs external
protobuf (as seen in cl/142286800).
2016-12-29 12:13:54 -06:00
Eric Anderson 04f216f072 Update README to reference 1.0.3 2016-12-29 12:11:07 -06:00
Eric Gribkoff 84eaefed6b interop-testing: Add status_code_and_message interop test 2016-12-28 17:22:46 -08:00
Eric Gribkoff 257062fa88 interop-testing: Add custom_metadata interop test 2016-12-27 10:01:33 -08:00
Kun Zhang b34d07d058 core: remove a benign data race. (#2546)
This is an alternative to #2543 and it doesn't introduce volatile usage.
2016-12-21 13:21:10 -08:00
Łukasz Strzałkowski 661413c2df core: Port PickFirst & RoundRobin LBs to v2 API (#2479) 2016-12-21 10:03:25 -08:00
Eric Gribkoff 24bc205a2b interop-testing: New client for HTTP/2 interop tests
These tests are for the new HTTP/2 test server (grpc/grpc#8900). They are designed to test client behavior when the server sends unexpected responses during rpcs.
2016-12-20 15:24:05 -08:00
Kun Zhang ec7d68bb36 okhttp: catch Throwable to avoid breaking preconditions. (#2536)
TransportSet mandates that transportShutdown() has been called prior to
transportTerminated().  OkHttp transport tries to meet this requirement
by calling startGoAway() which calls transportShutdown() in both the
normal path and the error path.  However, the error path only caught
Exception.  If an Error is thrown from the try-block, calling
transportTerminated() in the finally block will cause a check failure in
TransportSet, shadowing the original Error, which is undesirable for
debugging.  Catching Throwable here is more helpful.
2016-12-19 17:32:14 -08:00
Carl Mastrangelo 49b235dbbe benchmarks: update to jmh 1.17.3 2016-12-19 16:14:59 -08:00
ZHANG Dapeng bff6506f92 netty: no add_dep io.netty.handler.ssl.SslContext (#2529)
Not to expose dependency of `io.netty.handler.ssl.SslContext` when implementing `TransportCreationParamsFilter`

Change the `TransportCreationParamsFilter` API
````
ProtocolNegotiator getProtocolNegotiator(NegotiationType negotiationType, SslContext sslContext);
````
into
````
ProtocolNegotiator getProtocolNegotiator();
````
2016-12-16 16:20:31 -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
Carl Mastrangelo cb6cf1ae2f netty: refactor how internal netty channel works 2016-12-16 10:36:12 -08:00
ZHANG Dapeng e36eb10728 codehealth: errorprone, unused 2016-12-15 13:13:26 -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
Eric Gribkoff aada0780b8 services: Flow control for proto reflection service 2016-12-14 16:14:22 -08:00
Anuraag Agrawal 221fadcbdd Implement setListener in AbstractServerStream and remove from subclasses. 2016-12-14 12:29:10 -08:00
Carl Mastrangelo 1f2802a11f core: make forTarget(String) non-experimental 2016-12-14 10:15:12 -08:00
Kun Zhang 97b926391b context: add the four-value withValues(). (#2506) 2016-12-13 14:03:23 -08:00
Carl Mastrangelo 677f05d7fb netty: move internal channel builder code to a special accessor 2016-12-13 11:17:00 -08:00
Kun Zhang 178b5260c2 core: handle a race in DelayedClientTransport(2). (#2486)
* Fork DelayedClientTransport into DelayedClientTransport2, and fix a race
on it.  Consider the following sequence:

1. Channel is created. Picker is initially null

2. Channel has a new RPC. Because picker is null, the delayed transport
is picked, but newStream() is not called yet.

3. LoadBalancer updates a new picker to Channel. Channel runs
reprocess() but does nothing because no pending stream is there.

4. newStream() called on the delayed transport.

In previous implementation, newStream() on step 4 will not see the
picker. It will only use the next picker.

After this change, delayed transport would save the latest picker and
use it on newStream(), which is the desired behavior.

Also deleted all the code that will not be used after the LB refactor.


* Also fixed a bug: newStream() should always return a failing stream if it's shutdown. Previously it's not doing so if picker is not null.
2016-12-12 09:24:13 -08:00
Łukasz Strzałkowski bd9e041b74 netty: Add support for keepalive 2016-12-12 09:02:24 -08:00
Eric Anderson 0573c25c60 interop-testing: Observe --use_tls to disable TLS with OkHttp 2016-12-09 18:28:12 -08:00
Kun Zhang fd33a72174 core: thread-less ChannelExecutor. (#2493)
Dedicated for mutating states of ManagedChannelImpl, InternalSubchannel and LoadBalancer.
2016-12-08 18:38:29 -08:00
Lukasz Strzalkowski ecb79ce36f Update param name for saving histograms 2016-12-08 11:21:50 -08:00
Eric Anderson cfb6bd0fe2 context: Fix ErrorProne ClassNewInstance
http://errorprone.info/bugpattern/ClassNewInstance
2016-12-08 10:33:31 -08:00
Kenji Kaneda 21bca9a475 core: Add @Nullable to Metadata#get 2016-12-08 10:25:21 -08:00
Eric Anderson e999f8da62 core: Fix ErrorProne failure for ForOverride
Methods overriding a ForOverride method should not be public.
2016-12-08 10:08:12 -08:00
Eric Anderson 67ff170b96 docs: Place all badges together 2016-12-06 16:45:00 -08:00
Joey Bratton b6ebede94f testing: added junit rule for in-process servers
GrpcServerRule configures an in-process server and channel. It is
useful for asserting requests being made to a service. A consumer can
create a mock implementation of their service that records each
request, then make assertions on those records in their test.
2016-12-06 09:32:04 -08:00
Kailash Sethuraman a10261af48 all: add gitter chat icon to the README.md file 2016-12-05 15:12:36 -08:00
Lukasz Strzalkowski 483f3d55e9 Remove deadcode 2016-12-05 14:17:13 -08:00
Carl Mastrangelo cb1ba5bf39 core: remove extra allocation in MessageFramer
OutputStreamAdapter is a private class, and is only ever called by two
places: ByteStreams.copy, which never calls the single byte method, and
DrainTo, which potentially can.  There are two classes that implement
DrainTo, which is primarily ProtoInputStream.  It calls
MessageLite.writeTo(OutputStream) or back again to ByteStreams.copy.

MessageLite.writeTo in turn wraps the OutputStream in a
CodedOutputStream.OutputStreamEncoder, which then never calls the single
byte version.  Thus, all know implementations never call the single
byte override.

Additionally, it is well known that the single byte write is slow, and
is expected to be wrapped in a BufferedOutputStream if there are many
small writes.
2016-12-05 13:11:06 -08:00
Kenji Kaneda 1d5fd1fa35 core: Fix typos in GrpcUtil
- s/IMPLEMENTATION_VERION/IMPLEMENTATION_VERSION
- s/ACCEPT_ENCODING_SPLITER/ACCEPT_ENCODING_SPLITTER
2016-12-05 11:42:16 -08:00
Carl Mastrangelo 209a32fd1a core,netty: add a log id to the server and server transports 2016-12-05 09:47:35 -08:00
Carl Mastrangelo e9779d7c00 all: use a proper log id which can reference channels, subchannels, and transports 2016-12-02 15:35:11 -08:00
Kun Zhang 7ec8167ada core: LoadBalancer2 and DelayedClientTransport.reprocess(). (#2443)
This is the second step of a major refactor for the LoadBalancer-related part of Channel impl (#1600)
2016-12-02 10:31:34 -08:00
Carl Mastrangelo cbadf4b3e8 internal: mark internal subchannel methods for override 2016-12-02 10:25:46 -08:00
Kun Zhang 84862867f7 context: pluggable Storage mechanism. (#2461)
Currently Context propagate in-thread by its own ThreadLocal, and
cross-thread propagation must be done with the mechanisms provied by
gRPC Context.  However, there are frameworks (e.g. what we are using
inside Google) which have already established context-propagation
mechanisms.  If gRPC Context may ride on top of them, it would be
propagated automatically without additional effort from the application.

The Storage API allows gRPC Context to be attached to anything.  The
default implementation still uses its own ThreadLocal.  If an override
implementation is present, gRPC Context will use it.
2016-12-02 09:47:58 -08:00
Carl Mastrangelo f15ed05260 stub: remove a reference to internal 2016-12-02 09:13:37 -08:00
Michael Avrukin 4d4d4b386e core: improve error message for adding method (#2460)
Issue: grpc/grpc-java/issues/2437
2016-12-02 07:45:37 -08:00
Eric Anderson 8ecf05409e compiler: Explicitly specify std::
This is to follow style changes happening internally.
2016-12-01 16:10:23 -08:00
Carl Mastrangelo e71f2c942f core: make Status reference the correct internal Marshaller 2016-12-01 08:28:16 -08:00