284 Commits

Author SHA1 Message Date
e8a6e2844b stickiness: add stickiness support (#1969) 2018-04-24 10:37:52 -07:00
4166ea7dad Stage 2: Channelz metric collection (#1909) 2018-04-23 11:22:25 -07:00
7de9139327 Fix typos (#1994) 2018-04-16 10:03:02 -07:00
35a2846daa Various simplifications (gosimple)
This fixes:
clientconn.go:948:3: should write m = cc.sc.Methods[method[:i+1]] instead of m, _ = cc.sc.Methods[method[:i+1]] (S1005)
encoding/proto/proto_test.go:43:5: should use !bytes.Equal(p.GetBody(), expectedBody) instead (S1004)
resolver/dns/dns_resolver.go:260:2: should merge variable declaration with assignment on next line (S1021)
resolver/dns/dns_resolver.go:344:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
2018-04-15 15:32:33 +02:00
95bbf69653 Remove redundant return statements (gosimple)
This fixes:
balancer/base/balancer.go:149:2: redundant return statement (S1023)
balancer_v1_wrapper.go:260:2: redundant return statement (S1023)
balancer_v1_wrapper.go:273:2: redundant return statement (S1023)
balancer_v1_wrapper.go:285:2: redundant return statement (S1023)
benchmark/benchmark.go:68:2: redundant return statement (S1023)
clientconn.go:1461:2: redundant return statement (S1023)
grpclb.go:223:2: redundant return statement (S1023)
grpclb.go:260:2: redundant return statement (S1023)
grpclb_util.go:201:2: redundant return statement (S1023)
rpc_util.go:278:50: redundant return statement (S1023)
rpc_util.go:296:56: redundant return statement (S1023)
rpc_util.go:314:56: redundant return statement (S1023)
rpc_util.go:333:53: redundant return statement (S1023)
rpc_util.go:354:52: redundant return statement (S1023)
rpc_util.go:387:56: redundant return statement (S1023)
rpc_util.go:416:53: redundant return statement (S1023)
stream.go:651:2: redundant return statement (S1023)
2018-04-15 12:43:34 +02:00
35aeaeb587 documentation: mention DialContext is non-blocking by default (#1970) 2018-04-12 15:11:22 -07:00
cf3bf7f774 createTransport: check for SHUTDOWN before assigning TransientFailure to ac.state (#1979) 2018-04-10 12:48:04 -07:00
7f73c863c0 Channelz: Entity Registration and Deletion (#1811) 2018-04-09 11:13:06 -07:00
7316918402 clientconn: add support for unix network in DialContext. (#1883) 2018-04-09 11:12:34 -07:00
d0a21a3347 Export changes to OSS. (#1962) 2018-04-05 10:45:41 -07:00
f2620c3803 resolver: keep full unparsed target string if scheme in parsed target is not registered (#1943) 2018-03-27 13:58:27 -07:00
207e2760fd Fix test race: Atomically access minConnecTimout in testing environment. (#1897) 2018-03-07 10:36:17 -08:00
7c5299d71e Fix flaky test: TestCloseConnectionWhenServerPrefaceNotReceived (#1870)
* Atomically update minConnectTimeout in test.

* Refactor the flaky test.

* Post review update

* mend
2018-03-02 13:39:55 -08:00
12da026194 clientconn: fix a typo in GetMethodConfig documentation (#1867) 2018-02-21 10:14:52 -08:00
3926816d54 addrConn: Report underlying connection error in RPC error (#1855) 2018-02-14 14:13:10 -08:00
e014063a43 addrConn: keep retrying even on non-temporary errors (#1856) 2018-02-13 16:07:10 -08:00
365770fcbd streams: Stop cleaning up after orphaned streams (#1854)
This change introduces some behavior changes that should not impact users that
are following the proper stream protocol. Specifically, one of the following
conditions must be satisfied:

1. The user calls Close on the ClientConn.
2. The user cancels the context provided to NewClientStream, or its deadline
    expires. (Note that it if the context is no longer needed before the deadline
    expires, it is still recommended to call cancel to prevent bloat.) It is always
    recommended to cancel contexts when they are no longer needed, and to
    never use the background context directly, so all users should always be
    doing this.
3. The user calls RecvMsg (or Recv in generated code) until a non-nil error is
    returned.
4. The user receives any error from Header or SendMsg (or Send in generated
    code) besides io.EOF.  If none of the above happen, this will leak a goroutine
    and a context, and grpc will not call the optionally-configured stats handler
    with a stats.End message.

Before this change, if a user created a stream and the server ended the stream,
the stats handler would be invoked with a stats.End containing the final status
of the stream. Subsequent calls to RecvMsg would then trigger the stats handler
with InPayloads, which may be unexpected by stats handlers.
2018-02-08 10:51:16 -08:00
37346e3181 Revert "Add WithResolverUserOptions for custom resolver build options" (#1839)
This reverts commit ff1be3fcc57773d500921fad479d82ec171e2358.
2018-02-05 12:52:35 -08:00
5ba054bf37 encoding: Introduce new method for registering and choosing codecs (#1813) 2018-01-23 11:39:40 -08:00
10598f3eb3 Explain target format in DialContext's documentation (#1785) 2018-01-18 13:10:52 -08:00
e975017b47 Don't set reconnect parameters when the server has already responded. (#1779) 2018-01-04 11:16:47 -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
98b17f20a2 relocate check for shutdown in ac.tearDown() (#1723) 2017-12-15 12:03:41 -08:00
dba60db4f4 Switch balancer to grpclb when at least one address is grpclb address (#1692) 2017-12-12 12:45:05 -08:00
ff1be3fcc5 Add WithResolverUserOptions for custom resolver build options (#1711) 2017-12-06 15:54:01 -08:00
be077907e2 make load balancing policy name string case-insensitive (#1708) 2017-12-04 14:03:22 -08:00
ddbb27e545 client: backoff before reconnecting if an HTTP2 server preface was not received (#1648) 2017-12-01 09:55:42 -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
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
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
8ff8683602 Implement transparent retries for gRFC A6 (#1597) 2017-11-06 13:45:11 -08:00
af224a8a48 Check ac state shutdown before setting it to TransientFailure (#1643) 2017-11-02 09:56:04 -07:00
5db344a40a Introduce new Compressor/Decompressor API (#1428) 2017-10-31 10:21:13 -07:00
b3ed81a60b Fix connectivity state transitions when dialing (#1596) 2017-10-23 14:06:33 -07:00
1687ce5770 ClientHandshake should get the dialing endpoint as the authority (#1607) 2017-10-23 11:40:43 -07:00
5c3d956e18 Re-add support for Go1.6 (#1603) 2017-10-20 12:05:20 -07:00
94f1917696 Make passthrouth resolver the default instead of dns (#1606) 2017-10-20 12:03:44 -07:00
de0cff50aa Fix goroutine leak in grpclb_test (#1595) 2017-10-19 15:16:16 -07:00
6f3b6ff46b Parse ServiceConfig JSON string (#1515) 2017-10-19 12:09:19 -07:00
a353537ff5 Register and use default balancers and resolvers (#1551) 2017-10-19 11:32:06 -07:00
c8405557a4 Remove Go1.6 support (#1492) 2017-10-04 13:57:10 -07:00
5a82377e69 transport: refactor of error/cancellation paths (#1533)
- The transport is now responsible for closing its own connection when an error
  occurs or when the context given to it in NewClientTransport() is canceled.

- Remove client/server shutdown channels -- add cancel function to allow
  self-cancellation.

- Plumb the clientConn's context into the client transport to allow for the
  transport to be canceled even after it has been removed from the ac (due to
  graceful close) when the ClientConn is closed.
2017-10-02 11:56:31 -07:00
4bbdf230d7 New implementation of roundrobin and pickfirst (#1506) 2017-10-02 09:22:57 -07:00
8214c28a62 Make IO Buffer size configurable. (#1544)
* Make IO Buffer size configurable.

* Fixing typo
2017-09-28 14:11:14 -07:00
59cb69e66d Fix misspells (#1531) 2017-09-20 14:55:57 -07:00
8233e124e4 Add new Resolver and Balancer APIs (gRFC L9) (#1408)
- Add package balancer and resolver.
 - Change ClientConn internals to new APIs and adds a wrapper for v1 balancer.
2017-08-31 10:59:09 -07:00
2308131c44 addrConn: change address to slice of address (#1376)
* addrConn: change address to slice of address
* add pickfirst balancer to test new addrconn
2017-08-21 12:27:04 -07:00