Commit Graph

2164 Commits

Author SHA1 Message Date
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
Eric Gribkoff a446b5388f core: switch to scheduled closing of MessageDeframer 2017-08-11 16:52:45 -07:00
Eric Gribkoff 16575d01a3 core,netty,okhttp,testing: switch to StreamListener.messagesAvailable 2017-08-11 16:52:45 -07:00
Paul Gross 72b9ee22b8 all: Fix mismatch in naming Bazel Maven jars
This commit aligns the naming of the Bazel Maven jars with the names
used by Bazel's migration-tooling project:

https://github.com/bazelbuild/migration-tooling

Unfortunately, we can't fix @com_google_protobuf_java because it's
required by Bazel itself.

Fixes #3328
2017-08-11 16:39:43 -07:00
myPrecious 13ef2261d6 core: Use bulk operation instead of iteration 2017-08-11 15:42:14 -07:00
zpencer e195c1ab76 context: change storage API to return a restoreable context (#3292)
This API change allows storage implementations to put some state
information into the return value, giving it the ability to act
as a cookie. In environments where contexts can be replaced, the
current original context can be stashed there and be restored
when detach is called.
2017-08-10 19:30:53 -07:00
ZHANG Dapeng 65ea0bde5d core,grpclb: deprecate LoadBalancer.Helper.updatePicker() 2017-08-10 17:05:54 -07:00
Eric Gribkoff 1386453830 netty: check for stream before freeing flow control bytes on client 2017-08-10 15:02:34 -07:00
Kun Zhang c8216e45f2 grpclb: update load_balancer.proto to the latest version. (#3329)
Combined drop for rate limiting and drop for load balancing, broken down by token.
2017-08-10 14:53:51 -07:00
Eric Anderson c392a91a99 okhttp: Make Headers package-private
There was no way to use it without touching internal APIs, and it should
never have been public to begin with as it serves no purpose to a user.
2017-08-10 14:25:16 -07:00
Eric Gribkoff 15ca50ac7c interop-testing: larger timeout for HTTP/2 client 2017-08-10 13:48:25 -07:00
ZHANG Dapeng 71353c8f65 grpclb: implement Channel State API for GRPCLB 2017-08-09 18:01:03 -07:00
ZHANG Dapeng e5ef92c57c core: implement Channel State API for RoundRobin 2017-08-09 18:00:01 -07:00
ZHANG Dapeng 04fd4bc9b1 core: implement Channel State API for PickFirst 2017-08-09 17:59:34 -07:00
Eric Anderson c16edb3c90 core: Providers should consider Robolectric as Android
null class loader means to use the bootstrap class loader, which would
normally make sense. However, Robolectric tests run on OpenJDK and
provide the Android environment as part of the application, so "Android"
won't be present in the bootstrap class loader.
2017-08-09 11:01:15 -07:00
myPrecious f46280ae9f core: Java Refactor
Duplicate throws exception, and Javadoc issues: ManagedChannelImplTransportManagerTest.java has been deleted.
2017-08-09 09:11:19 -07:00
Eric Gribkoff 8585cd5e0d interop-testing: fix NPE on empty args to test service client 2017-08-07 17:20:54 -07:00
Eric Anderson 4147632bed netty: Update netty to 4.1.14
EmbeddedChannel now runs all pending tasks when the Channel is closed.
This caused the Http2ConnectionHandler to clear deframer references (on
channelInactive) on errors when it previously didn't. Now that the
errors were handled more fully, it exposed bugs in tests.
2017-08-07 14:11:57 -07:00
zpencer 6277c0ce4e benchmark: add missing server side workloads (#3136)
* benchmark: add server side workloads
2017-08-05 21:00:55 -07:00
Kun Zhang 16f4de4636 core/stats: report message count metrics to Census. (#3312) 2017-08-04 15:58:21 -07:00
Carl Mastrangelo 02cb718767 testing,core: don't use mocks for stream tracers (#3305)
This is a big, but mostly mechanical change.  The newly added Test*StreamTracer classes are designed to be extended which is why they are non final and have protected fields.  There are a few notable things in this:

1.  verifyNoMoreInteractions is gone.   The API for StreamTracers doesn't make this guarantee.  I have recovered this behavior by failing duplicate calls.  This has resulted in a few bugs in the test code being fixed.

2.  StreamTracers cannot be mocked anymore.  Tracers need to be thread safe, which mocks simply are not.  This leads to a HUGE number of reports when trying to find real races in gRPC.

3.  If these classes are useful, we can promote them out of internal.  I just put them here out of convenience.
2017-08-03 16:59:06 -07:00
Eric Anderson c4f91272d2 all: Remove unused variables and squelch incorrect ErrorProne warning 2017-08-02 15:48:23 -07:00
Eric Anderson de8b411773 compiler: Fix some warnings when building with Bazel
This fixes sign-compare and maybe-unintialized. An unused-value warning
remains.

I changed LogHelper to always call abort so the compiler would know the
method does not return, which fixed the maxbe-uninitialized warning.
2017-08-02 14:29:40 -07:00
Stephen Haberman db9b7ed8c0 Don't schedule multiple pings.
If onTransportActive ran while SendPing was already scheduled, we would
schedule another SendPing, which seems fine, but the server might observe
us sending pings too quickly, and make us GOAWAY.

Fixes #3274.
2017-08-01 11:25:24 -07:00
ZHANG Dapeng 18970e6ef3 core: fix ConnectivityStateManager is already disabled bug 2017-08-01 10:26:02 -07:00
Eric Gribkoff c0e010af8f interop-testing: implement compression interop tests 2017-07-31 16:08:23 -07:00
Kun Zhang a3a306fd4e core: enable Census tags propagation by default. (#3294)
According to Census team, the tag wire format is now stable.
2017-07-31 14:55:48 -07:00
Kun Zhang f54a2df67f grpclb: force GRPCLB policy when NameResolver returns at least one balancer. (#3291)
Previously only when all addresses returned by NameResolver are
balancers would GRPCLB be forced.  This change is a follow-up of
https://github.com/grpc/grpc/pull/10258
2017-07-31 11:07:11 -07:00
Eric Anderson 9be41ba0e8 core,auth: Stabilize auth flow using CallCredentials
As discussed in #1914, we need CallCredentials and MoreCallCredentials
to be stable, but there's less of a strong need for the contents of
CallCredentials to be stable. We're willing to commit to the name,
without needing to commit to the plumbing.
2017-07-27 18:07:18 -07:00
Carl Mastrangelo 3efaccd81f netty: support `status()` on Headers
* netty: support `status()` on Headers

Recent Netty change a91df58ca1
caused the `status()` method to be invoked, which AbstractHttp2Headers does not implement.
This change is necesary to upgrade to Netty 4.1.14
2017-07-27 12:17:27 -07:00