2419 Commits

Author SHA1 Message Date
0547980095 Notify parent ClientConn to re-resolve in grpclb (#1699)
The parent ClientConn should re-resolve when grpclb loses connection to the
remote balancer.

When the ClientConn inside grpclb gets a TransientFailure, it calls
lbManualResolver.ResolveNow(), which calls parent ClientConn's ResolveNow, and
eventually results in re-resolve happening in parent ClientConn's resolver (DNS
for example).

This PR adds a method to balancer.ClientConn interface, so balancer can tell
parent ClientConn to re-resolve.
2017-12-18 15:36:55 -08:00
e6549e636d Add dial option to set balancer (#1697)
WithBalancerName dial option specifies the name of the balancer to be used by the ClientConn. Service config updates can NOT override the balancer option.
2017-12-18 15:35:42 -08:00
6610f9a340 Fix test: Data race while resetting global var. (#1748) 2017-12-18 15:27:23 -08:00
f4b523765c status: add Code convenience function (#1754) 2017-12-18 15:00:50 -08:00
47bddd7d06 vet: run golint on _string files (#1749)
We didn't run this because codes_string.go was generated by stringer. And we no longer use stringer.
2017-12-18 10:58:57 -08:00
45088c2971 examples: fix concurrent map accesses in route_guide server (#1752) 2017-12-18 10:21:30 -08:00
4e393e0b21 grpc: fix deprecation comments to conform to standard (#1691) 2017-12-18 09:23:42 -08:00
0b24825eb1 Adjust keepalive paramenters in the test such that scheduling delays don't cause false failures too often. (#1730) 2017-12-15 16:03:42 -08:00
f9390a7b4d fix typo (#1746) 2017-12-15 14:50:30 -08:00
6ef45d3689 fix stats flaky test (#1740)
1. Call transport Close if newHTTP2Server returns non-nil error.
Handle ConnBegin was called before this error, and handle ConnEnd is not called (because Close() is not called), which caused ConnStats check to fail.

2. Skip stats test in go1.6.
go1.6 doesn't have DialContext (we use Dialer(Cancel: ctx.Done()) instead). When the give context is canceled, this function sometimes returns canceled error, while the server side still gets the conn. This caused the server blocking on reading the preface (which will eventually timeout, but the tests are too short for that), and there will be a missing ConnEnd.
2017-12-15 14:37:20 -08:00
98b17f20a2 relocate check for shutdown in ac.tearDown() (#1723) 2017-12-15 12:03:41 -08:00
5ff10c3b65 fix flaky TestPickfirstOneAddressRemoval (#1731) 2017-12-14 15:42:58 -08:00
2625f0335f bufconn: allow readers to receive data after writers close (#1739) 2017-12-14 15:17:55 -08:00
b0e0950972 After sending second goaway close conn if idle. (#1736) 2017-12-14 14:57:47 -08:00
b8cf13ea06 Make sure all goroutines have ended before restoring global vars. (#1732) 2017-12-14 13:23:05 -08:00
4742c425a7 client: fix race between server response and stream context cancellation (#1729)
* While waiting for headers from the server, client should wait on error chans as well.

* Stream read shouldn't wait on transport ctx
2017-12-14 13:19:12 -08:00
8fba5fc8fd In gracefull stop close server transport only after flushing status of the last stream. (#1734) 2017-12-13 16:09:49 -08:00
d1fc8fa770 Deflake tests that rely on Stop() then Dial() not reconnecting (#1728) 2017-12-13 09:30:53 -08:00
dba60db4f4 Switch balancer to grpclb when at least one address is grpclb address (#1692) 2017-12-12 12:45:05 -08:00
cce0e436e5 Merge pull request #1724 from grpc/jtattermusch-patch-1
Update CONTRIBUTING.md to CNCF CLA
2017-12-11 09:35:50 -08:00
ca1b23bf3e Update CONTRIBUTING.md to CNCF CLA 2017-12-11 09:04:48 -08:00
2941ee12eb codes: Add UnmarshalJSON support to Code type (#1720) 2017-12-11 09:02:19 -08:00
ec61302c8e naming: Fix build constraints for go1.6 and go1.7 (#1718)
"go1.6, !go1.8" constraints are interpreted as (version >= 1.6 AND ) OR version < 1.8, where (version >= 1.6 AND ) is always false,
so it matches all go versions before 1.8, not only 1.6 and 1.7.

Removed a space, so the constraints are now matches only go1.6 and go1.7 versions
2017-12-07 12:43:58 -08:00
b8191e57b2 remove stringer and go generate (#1715) 2017-12-06 17:35:20 -08:00
ff1be3fcc5 Add WithResolverUserOptions for custom resolver build options (#1711) 2017-12-06 15:54:01 -08:00
580defabfe Fix grpc basics link in route_guide example (#1713) 2017-12-06 15:11:16 -08:00
b7dc71e7ea Optimize codes.String() method using a switch instead of a slice of indexes (#1712) 2017-12-06 10:50:43 -08:00
1fc873d0f6 Disable ccBalancerWrapper when it is closed (#1698) 2017-12-06 10:49:20 -08:00
bf35f1b961 Refactor roundrobin to support custom picker (#1707)
Split round_robin balancer into a base balancer (which manages SubConn and connectivity states), and a round_robin picker.
A custom picker with other picking algorithms can be provided to build custom balancers.
2017-12-05 11:27:28 -08:00
43083423e4 Change parseTimeout to not handle non-second durations (#1706) 2017-12-05 10:04:04 -08:00
be077907e2 make load balancing policy name string case-insensitive (#1708) 2017-12-04 14:03:22 -08:00
cd563b81ec protoCodec: avoid buffer allocations if proto.Marshaler/Unmarshaler (#1689)
* protoCodec: return early if proto.Marshaler

If the object to marshal implements proto.Marshaler, delegate to that
immediately instead of pre-allocating a buffer. (*proto.Buffer).Marshal
has the same logic, so the []byte buffer we pre-allocate in codec.go
would never be used.

This is mainly for users of gogoproto. If you turn on the "marshaler"
and "sizer" gogoproto options, the generated Marshal() method already
pre-allocates a buffer of the appropriate size for marshaling the
entire object.

* protoCodec: return early if proto.Unmarshaler

If the object to unmarshal implements proto.Unmarshaler, delegate to
that immediately. This perhaps saves a bit of work preparing the
cached the proto.Buffer object which would not end up being used for
the proto.Unmarshaler case.

Note that I moved the obj.Reset() call above the delegation to
obj.Unmarshal(). This maintains the grpc behavior of
proto.Unmarshalers always being Reset() before being delegated to,
which is consistent to how proto.Unmarshal() behaves (proto.Buffer
does not call Reset() in Unmarshal).
2017-12-01 15:32:05 -08:00
61c67402b9 Add comments to ClientConn/SubConn interfaces to indicate new methods may be added (#1680) 2017-12-01 13:25:57 -08:00
ddbb27e545 client: backoff before reconnecting if an HTTP2 server preface was not received (#1648) 2017-12-01 09:55:42 -08:00
a4bf341022 use the request context with net/http handler (#1696) 2017-11-30 14:37:49 -08:00
c6b46087ab transport: fix race sending RPC status that could lead to a panic (#1687)
WriteStatus can be called concurrently: one by SendMsg,
the other by RecvMsg. Then, closing writes channel
becomes racey without proper locking.

Make transport closing synchronous in such case.
2017-11-30 13:58:31 -08:00
00383af260 Fix misleading default resolver scheme comments (#1703)
Since a recent change, the default is `passthrough`, not `dns`.
2017-11-30 13:47:14 -08:00
a62701e4aa Eliminate data race in ccBalancerWrapper (#1688) 2017-11-28 14:41:43 -08:00
1e1a47f0f2 Re-resolve target when one connection becomes TransientFailure (#1679)
This allows ClientConn to get more up-to-date addresses from resolver.
ClientConn compares new addresses with the cached ones. So if resolver returns the same set of addresses, ClientConn will not notify balancer about it.

Also moved the initialization of resolver and balancer to avoid race. Balancer will only be started when ClientConn gets resolved addresses from balancer.
2017-11-28 13:16:53 -08:00
2ef021f78d New grpclb implementation (#1558)
The new grpclb supports fallback to backends if remote balancer is unavailable
2017-11-27 11:16:26 -08:00
10873b30bf Fix panics on balancer and resolver updates (#1684)
- NewAddress with empty list (addrConn with an empty address list)
 - NewServiceConfig to switch balancer before the first balancer is built
2017-11-22 13:59:20 -08:00
646f701c82 Change version to 1.9.0-dev (#1682) 2017-11-22 10:46:06 -08:00
6253aa9397 set context timeout when Timeout value >= 0 (#1678)
To be consistent with call.go/invoke

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-20 13:49:49 -08:00
d6cc72862b switch balancer based on service config info (#1670) 2017-11-17 11:11:05 -08:00
816fa5b06f Add proper support for 'identity' encoding type (#1664) 2017-11-17 09:24:54 -08:00
c1fc29613d update code_string.go for new stringer changes (#1674)
To fix travis check failures
2017-11-14 15:20:10 -08:00
409fd8e23b addrConn: set ac.state to TransientFailure upon non-temporary errors (#1657)
So failfast RPCs will fail with unavailable errors when this happens.
2017-11-13 16:33:42 -08:00
87bcb38fba Eliminate race on ac.acbw (#1666)
Guard ac.acbw with mutex
2017-11-13 13:43:31 -08:00
5f2e2f999e Corrected documentation on Server.Serve (#1668) 2017-11-13 13:37:12 -08:00
de2209a968 Update picker doc when returned SubConn is not ready (#1659) 2017-11-09 13:53:22 -08:00