Commit Graph

1732 Commits

Author SHA1 Message Date
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 a3a5420922 context: don't log to logger in static initialization. (#2581) 2017-01-10 11:10:15 -08:00
Eric Anderson de10b94128 readme: Downgrade protoc to 3.0.2 to match grpc-protobuf
Protobuf runtime 3.0.2 is included transitively via grpc-protobuf
v1.0.3. Protoc doesn't have to match the version identically, but must
not be newer than the runtime. We must wait until v1.1 release of grpc
to bump protobuf version in the readme.

Fixes #2578
2017-01-10 11:09:49 -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
Eric Anderson cc934b0b67 testing: Remove accidental cast to char in file IO
Also add forgotten close() for the InputStream.
2017-01-09 13:52:26 -08:00
Kenji Kaneda fed9be28ca benchmarks: do not set done to true when HistogramFuture#get 2017-01-09 11:22:01 -08:00
htuch 7fbee39c3a Introduce a grpc-exp ALPN protocol identifier
This patch introduces an additional ALPN protocol, grpc-exp, intended to
take preference to h2 and indicate to the server that the connection
contains only gRPC traffic. This allows servers and intermediate boxes
to distinguish gRPC from other HTTP/2 traffic.

The choice of grpc-exp as a protocol identifier indicates that this
scheme is currently experimental and should not be relied upon. The
protocol is not in the IANA TLS registry.

This is the grpc-java equivalent of
8cdf17a620.

Due to the opacity of ALPN and TLS negotiation at application level, the
tests are only there to validate that the lists we're feeding into the
negotiation process have the desired ordering properties:

  * If grpc-exp is present, h2 is as well.

  * grpc-exp is preferenced over h2.
2017-01-09 10:40:56 -08:00
Carl Mastrangelo 4afb914939 all: update styleguide XML to canonical one on github 2017-01-09 10:19:32 -08:00
Kun Zhang ea4390cf5c context: put ContextStorageOverride in io.grpc.override. (#2570)
To make it easier to filter.
2017-01-06 08:55:29 -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
ZHANG Dapeng 4a4f25ada4 weekly cleanup: errorprone, javastyle, unused (#2566) 2017-01-05 16:13:25 -08:00
Eric Anderson 5204e4f29e releasing: Document bumping version on grpc.io 2017-01-05 13:25:05 -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
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