Commit Graph

2193 Commits

Author SHA1 Message Date
Carl Mastrangelo 53f56a32f1 inprocess,core: add ManagedChannelBuilder and ServerBuilder factory hiders
* inprocess,core: add ManagedChannelBuilder and ServerBuilder factory hiders

Because the factory for Channels and Servers resides on the builder
itself, it is easy for subclasses to accidentally inherit the
factory.  This causes confusion, because calling a static method on
a specific class may result in a different class.

This change adds hiding static factories to each builder, and a test
to enforce that each subclass hides the factory.  The test lives in
the interop tests, because it has a classpath dependency on all the
existing transports.

Minor note: the test scans the classpath using a Beta Guava API.
The test can be disabled if the API goes away.
2017-09-06 15:21:17 -07:00
Kun Zhang ddd31d6799 core/census: set method name tag to the server handler's context (#3436) 2017-09-06 10:04:50 -07:00
zpencer 671783f912 protobuf-nano: use existing class IoUtils for toByteArray (#3437)
protobuf-nano: use existing class IoUtils and force protobuf-nano
to use exact version of internal
2017-09-06 07:30:58 -07:00
zpencer 78831690f6 protobuf-nano: avoid using @Beta API com.google.common.io.ByteStreams (#3433) 2017-09-05 09:08:52 -07:00
Carl Mastrangelo aaebf6e967 core: name more anonymous classes in ServerImpl
This makes it much easier to read stack traces since the name of the
event is in the frame.
2017-09-01 15:32:07 -07:00
zpencer b579528c89 Update README to reference 1.6.1 (#3428) 2017-08-31 15:24:33 -07:00
Carl Mastrangelo 4c721b7490 core: save alloc in SerializingExecutor 2017-08-30 12:52:25 -07:00
Carl Mastrangelo f61acf5eb9 core: remove unused buffer methods 2017-08-29 19:05:06 -07:00
zpencer e6fc6f33a5 netty: NOOP_MESSAGE must be staged before connect() (#3411)
Addresses flakey test
Fixes #3408
2017-08-28 17:48:14 -07:00
Eric Anderson 6164b7b2ee Move jmh benchmarks to their respective modules
The benchmarks should be close to the code they're benchmarking, like
we do with tests.

This includes a bugfix to SerializingExecutorBenchmark to let it run.

The io.grpc.benchmarks.netty benchmarks in benchmarks/ depend on
ByteBufOutputMarshaller from benchmarks's main, so they were not moved.
2017-08-28 13:37:39 -07:00
Eric Gribkoff 812e65a5ca context: add RunWith annotation 2017-08-28 12:11:02 -07:00
Eric Anderson 97c625fa79 netty: Update to Netty 4.1.15
We'll need to figure out what we want to do about the deprecated API.
We'll probably just drop the verification check, but need to look into
it a bit.
2017-08-28 10:23:13 -07:00
Eric Anderson 3620931eae context: Use polymorphism instead of canBeCancelled field 2017-08-28 09:41:56 -07:00
Eric Anderson 21cd244734 context: Remove superfluous cascadesCancellation field 2017-08-28 09:41:56 -07:00
Eric Anderson 32cd4a0660 compiler: Produce unified output on diff failure
This includes the file names and context, which is soo much nicer.
2017-08-25 16:41:39 -07:00
Carl Mastrangelo 24ff2748b7 all: update to proto 3.4.0 2017-08-25 11:25:36 -07:00
Carl Mastrangelo a53d030b5c core: fix lint warnings 2017-08-25 11:23:03 -07:00
Kun Zhang 485431880f grpclb: remove expiration_interval. (#3398) 2017-08-25 10:49:46 -07:00
Eric Gribkoff cfc9433ee3 core: advance past empty buffer in CompositeReadableBuffer (#3392) 2017-08-24 21:35:25 -07:00
Carl Mastrangelo c024f17429 netty,okhttp: include more detail about ALPN missing
Additionally: include info on why android classes are missing
2017-08-24 16:00:36 -07:00
Eric Anderson 521c55e9bd Avoid request threads on AppEngine Java 8
While the code had correctly determined full threads were available, the
call to MoreExecutors returned a request thread factory, which has
limitations.

Note that Async stub users may not be able to call GAE APIs in
callbacks. This is because the threads aren't request threads. They can
override the individual call's executor with
com.google.appengine.api.ThreadManager.currentRequestThreadFactory() in
an interceptor via callOptions.withExecutor().

Fixes #3296
2017-08-24 15:47:45 -07:00
ZHANG Dapeng 23dfc84ccf interop-testing: fix dealineExceeded test flakiness by increasing time interval
Should resolve #1399
2017-08-24 14:27:49 -07:00
zpencer 2cbe9ef66a jmh: accidentally checked in foo.txt (#3391)
Remove this file
2017-08-24 14:02:18 -07:00
Eric Anderson 7cafb6745b context: Store Deadline in CancellableContext directly 2017-08-24 13:21:06 -07:00
zpencer 68e8dc240c netty: graceful shutdowns should for streams to close (#3386)
Previously we have a hard timeout of 5s, which isn't very graceful.
2017-08-24 10:16:12 -07:00
John Hume 7d0229a1f5 Also fix bazel name of io.netty:netty-transport 2017-08-23 15:48:08 -07:00
John Hume 5c902c9384 Fix gson / opencensus bazel naming mixup
In 72b9ee2, gson kept its old name while opencensus got what should have
become gson's new name instead of a fixed opencensus name.
2017-08-23 15:48:08 -07:00
ZHANG Dapeng fe1583c9b4 netty: fix transport spuriously in notInUse state
Previously, if two streams are added (but not active yet), then the transport is changed into inUse; after that, if one of them gets active and then closed and removed, then the transport will be changed into and staying at notInUse, although the other stream could later be active.
2017-08-23 13:38:05 -07:00
ZHANG Dapeng dafea0100a core: ForwardingChannelBuilder
Introduced `ForwardingChannelBuilder`, in the same pattern as `ForwardingClientCall` etc.
2017-08-23 12:48:12 -07:00
Eric Anderson 182164eafc compiler: Add option to disable version output
If the option becomes popular, we can just remove the version.
2017-08-23 12:37:40 -07:00
Kun Zhang ab65c797bf grpclb: refactor main GRPCLB logic out of GrpclbLoadBalancer. (#3369)
GrpclbLoadBalancer can work in non-GRPCLB (delegate) mode according to
name resolution results.  Previously the policy selection, delegation
and GRPCLB logic are in the same file, which is not very readable.  It
will get worse as we going to implement policy fallback logic soon.
This PR refactors the GRPCLB logic out, and makes GrpclbLoadBalancer
focus on the policy selection and delegation logic.
2017-08-23 11:24:56 -07:00
zpencer ab85c5ae76 Start 1.7.0 development cycle (#3357)
This bump changelist is applied a bit late with respect to the
1.6.0 branch cut. Look at the 1.6.0 to see the source of truth of
where it was cut. Do not assume it is the commit that precedes
this one.
2017-08-22 12:29:03 -07:00
zpencer e707d95d77 context: compress cancellation ancestor chain (#3372)
Now that we have the copy of write keyvalue store (#3368), there
is no need to keep the full parent chain. We only need a
reference to the nearest cancellable ancestor. This optimization
should in theory make cancellations more efficient and also make
our data structs more GC friendly.
2017-08-22 09:20:31 -07:00
zpencer 608b95547b context: remove unused fields from removed bloomfilter (#3371)
remove unused fields from removed bloom filter
2017-08-22 08:21:31 -07:00
zpencer b45e354411 context: hashtrie based keyvalue store (#3368)
This is the hashtrie data structure authored by @ejona86

The linked list key value store is known cause problems in
pathological cases where users keep updating the same key(s) over and
over. This copy on write tree will bound reads at O(lgN) where N is
the number of keys in the map, rather than O(lgM) where M is the total
number of put operations.

Also:

- added some unit tests
- ran a test putting random keys into the map and comparing the result
  with a java.util.HashMap to verify sanity. The test passes but I
  won't check it into the repo because it takes a long time to run:
  https://gist.github.com/zpencer/12cb435235d171c1fe09aef18825fad0
2017-08-21 16:35:17 -07:00
Kun Zhang 8d6ff4c9b4 core: enable Census trace context propagation. (#3361)
Note a Census tracing implementation, which is not included in gRPC,
is still required for tracing to work.
2017-08-18 17:19:52 -07:00
Eric Anderson 6ca91c4356 netty: Handle shutdown and failures during negotiator
NettyClientTransport needs to call close() on the Channel directly
instead of sending a message, since the message would typically be
delayed until negotiation completes.

The closeFuture() closes too early to be helpful, which is very
unfortunate. Using it squelches the negotiator's error handling. We now
rely on the handlers to report shutdown without any back-up. The
handlers error handling has matured, so maybe this is okay.
2017-08-18 14:38:48 -07:00
Kun Zhang 8634632019 grpclb: use two-level drop behavior (#3343)
Previously, the round-robin list that the client uses (effective
round-robin list, ERRL) was the received round-robin list (RRRL)
excluding non-READY backends.  Drop and backend entries are in the
same list.

The problem with it is that when not all backends are READY, drop
entries take a larger proportion in ERRL than they do in the RRRL,
resulting a larger drop ratio than intended.

To fix this, we employ a two-list scheme:

- A "drop list" (DL) that is out of the RRRL, with the same size and
  the same number of drop entries.

- A "backend list" (BL) that contains only the backend entries from
  the RRRL, excluding non-READY ones.

For every pick, the client would round-robin on the DL to determine
whether the pick should be dropped.  Only when it's not dropped,
round-robin on the BL to pick the actual backend.

This way, the drop ratio is always equal to the proportion they take
in the RRRL.
2017-08-16 16:03:22 -07:00
Kun Zhang 34857580ff core/test: remove ineffective assertions. (#3352)
The assertions are actually wrong and fail every time.  It doesn't
cause test failures because SharedResourceHolder calls them in a
scheduled executor because of its delayed close feature.

It's better to remove them, rather than leaving them there deceiving
us.
2017-08-16 15:59:48 -07:00
zpencer 197f0b8668 benchmark: context benchmark (#3263)
* replace read benchmark with the one written by lukesandberg
* add a WriteBechmark
2017-08-16 10:38:30 -07:00
zpencer 47ce000464 add bloom filter to Context (#3350)
* This is the bloom filter based context improvement authored by @lukesandberg
2017-08-16 10:38:02 -07:00
Kun Zhang 41410345e6 core: pass status to ManagedClientTransport.shutdown() (#3351)
This aligns with shutdownNow(), which is already accepting a status.
The status will be propagated to application when RPCs failed because
of transport shutdown, which will become useful information for debug.
2017-08-16 10:23:07 -07:00
Vladimir Gordiychuk ca7685ef50 protobuf-lite: ProtoLiteUtils fix infinite loop
InputStream by contract can return zero if requested length equal to zero.

```
If len is zero, then no bytes are read and 0 is returned;
otherwise, there is an attempt to read at least one byte.
If no byte is available because the stream is at end of file,
the value -1 is returned; otherwise, at least one byte is read
and stored into b.
```

Close #3323
2017-08-15 16:04:24 -07:00
ZHANG Dapeng 577bbefd1a netty: fix keepalive test flakiness
In `NettyHandlerTestBase` class, extended Netty's `EmbeddedChannel` by overriding`eventLoop()` to return an `eventLoop` that uses `FakeClock.getScheduledExecutorService() to schedule tasks.

Resolves #3326
2017-08-15 10:49:01 -07:00
Eric Gribkoff e4cef9d12d android-interop-testing: remove gms version metadata, add minimum sdk 2017-08-14 18:57:02 -07:00
ZHANG Dapeng 34f31fe3c6 netty: Not to ignore tests for window overriding
As noted after `@Ignore`
> Re-enable once https://github.com/grpc/grpc-java/issues/1175 is fixed

#1175 has been closed for a long time, should re-enable the tests.
2017-08-14 12:58:17 -07:00
Eric Gribkoff 3795417ed2 interop-testing: use Activity.RESULT_OK (-1) instead of 0 2017-08-11 17:39:52 -07:00
ZHANG Dapeng c71e2919de all: fix typo of overridden
s/overriden/overridden/g
2017-08-11 16:53:53 -07:00
ZHANG Dapeng 8e0cf27822 core: use static imports for repeated state enums 2017-08-11 16:53:16 -07:00
Eric Gribkoff 9b74f8e756 core,netty,okhttp: add option to deframe in app thread 2017-08-11 16:52:45 -07:00