Commit Graph

46 Commits

Author SHA1 Message Date
Easwar Swaminathan 449f1b222a
grpclb: rename LB policy config field to `serviceName` (#5166) 2022-01-25 10:53:10 -08:00
Shihao Xia ec7cf6c977
grpclb: fix possible nil before conversion in TestDropRequest (#5022) 2021-12-22 12:41:46 -08:00
Easwar Swaminathan 6d465fe912
grpclb: move restartableListener to testutils (#4919) 2021-11-01 11:04:24 -07:00
Menghan Li bd0f88150d
grpclb: recover after receiving an empty server list (#4879) 2021-10-20 10:52:03 -07:00
Easwar Swaminathan 6c56e211a0
grpclb: add `target_field` to service config (#4847) 2021-10-11 14:55:12 -07:00
apolcyn 0a8c63739a
grpclb: propagate the most recent connection error when grpclb enters transient failure (#4605) 2021-07-21 10:50:37 -07:00
Menghan Li 78864797b8
balancer: set RPC metadata in address attributes, instead of Metadata field (#4041)
This metadata will be sent with all RPCs on the created SubConn
2020-11-18 17:12:51 -08:00
Menghan Li 1d01bf995d
grpclb: consider IDLE SubConns as connecting (#4031)
Otherwise, when the first response is received from the grpclb server, the
parent ClientConn enters TransientFailure, and the first several
non-wait-for-ready RPCs will fail.
2020-11-16 11:57:00 -08:00
Menghan Li d6f8e6fbaf
grpclb: send custom user-agent (#4011) 2020-11-09 14:08:58 -08:00
Gaurav Gahlot d7a7a304ff
testing: Avoid using context.Background (#3949) 2020-11-05 09:25:17 -08:00
Doug Fawley 02cd07d9bb
cmd/protoc-gen-go-grpc: revert to interface-based service registration (#3911) 2020-09-29 15:17:06 -07:00
Doug Fawley 44d73dff99
cmd/protoc-gen-go-grpc: rework service registration (#3828) 2020-08-25 09:28:01 -07:00
Zou Nengren 4e63bcab52
test: replace manual.GenerateAndRegisterManualResolver with grpc.WithResolvers (#3700) 2020-06-23 09:49:44 -07:00
Doug Fawley eb11ffdf9b
retry: prevent per-RPC creds error from being transparently retried (#3677) 2020-06-11 09:18:17 -07:00
Doug Fawley ad51f572fd
protoc-gen-go-grpc: add requirement of embedding UnimplementedServer in services (#3657) 2020-06-04 10:56:13 -07:00
Doug Fawley eb827fbfd8
grpclb, dns: pass balancer addresses via resolver.State (#3614) 2020-05-26 15:24:52 -07:00
Garrett Gutierrez fff75ae40f
channelz: log on channelz trace events and trace on channelz relevant logs. (#3329)
channelz: log on channelz trace events and trace on channelz relevant logs. (#3329)
2020-02-14 10:11:26 -08:00
Garrett Gutierrez 132187f04c
Modified tests to use tlogger. (#3343)
* Modified tests to use tlogger.

* Fail on errors, with error expectations.

* Added expects and MixedCapsed grpclb_config tests

* Moved tlogger to grpctest, moved leakcheck tester to grpctest.go

* Added ExpectErrorN()

* Removed redundant leak checks

* Fixed new test

* Made tlogger globals into tlogger methods

* ErrorsLeft -> EndTest

* Removed some redundant lines

* Fixed error in test and empty map in EndTest
2020-02-06 13:03:20 -08:00
Doug Fawley 597699c0ef
grpclb: support explicit fallback signal (#3351) 2020-02-05 10:16:25 -08:00
Doug Fawley 085c980048
grpclb: do not send redundant empty load reports to remote LB (#3249)
Small refactor of tests:

- Add a channel to remoteBalancer on which to send received stats messages
- Change runAndGetStats to runAndCheckStats to allow for faster successful test
  runs (no longer need to sleep for one whole second per test).
- Remove redundant leak check from runAndCheckStats, otherwise excess load
  report messages not read from the channel will result in an infinite loop.
- Add String method to rpcStats to avoid data race between merging and printing.
2019-12-12 14:10:47 -08:00
Doug Fawley dc49de8acd
balancer: add V2Picker, ClientConn.UpdateState, SubConnState.ConnectionError (#3186)
Also implement V2 versions of base.*, xds, pickfirst, grpclb, and round robin balancers.
2019-11-21 10:27:29 -08:00
Doug Fawley 2cb07fcd90
resolver: rename Option to Options, leaving type aliases for now (#3175) 2019-11-12 15:23:46 -08:00
Menghan Li 459a38a0e3
grpclb: enter fallback if no balancer addresses are available (#3119)
This is necessary because there's another way to select grpclb (by specifying grpclb in service config's balancing policy field). So it's possible that grpclb is picked, but resolver doesn't have any balancer addresses.

When an update without balancer address is received, grpclb closes the underlying ClientConn to remote balancer, and enters fallback mode.

Note that grpclb waits until the ClientConn and the RPC goroutines are actually closed to do the fallback work. This can avoid race caused by async close.
2019-10-31 09:43:18 -07:00
Doug Fawley df162eae76
test: embed Unimplemented___Server in every service (#3076) 2019-10-04 13:22:31 -07:00
Doug Fawley ed563a02ea
resolver: add State fields to support error handling (#2951) 2019-10-04 12:59:43 -07:00
Doug Fawley 977142214c
client: fix race between transport draining and new RPCs (#2919)
Before these fixes, it was possible to see errors on new RPCs after a
connection began draining, and before establishing a new connection.  There is
an inherent race between choosing a SubConn and attempting to creating a stream
on it.  We should be able to avoid application-visible RPC errors due to this
with transparent retry.  However, several bugs were preventing this from
working correctly:

1. Non-wait-for-ready RPCs were skipping transparent retry, though the retry
design calls for retrying them.

2. The transport closed itself (and would consequently error new RPCs) before
notifying the SubConn that it was draining.

3. The SubConn wasn't synchronously updating itself once it was notified about
the closing or draining state.

4. The SubConn would go into the TRANSIENT_FAILURE state instantaneously,
causing RPCs to fail instead of queue.
2019-07-22 16:07:55 -07:00
Menghan Li 43c0599b22
test: fix flaky grpclb TestDropRequest (#2865) 2019-06-24 09:38:28 -07:00
Doug Fawley d40a995895
balancer/resolver: add loadBalancingConfig and pre-parsing support (#2732) 2019-05-30 09:12:58 -07:00
Menghan Li 3f98697f44
grpclb: handle service config and switch to pickfirst (#2719) 2019-04-11 11:25:27 -07:00
Menghan Li 4745f6ae0d
grpclb: fallback after init (#2681)
regenerate picker when switching between fallback/non-fallback, because new SubConn state might not be updated for cached SubConns
2019-04-02 16:27:52 -07:00
Doug Fawley 3910b873d3
bar: add ability to update resolver state atomically and pass directly to the balancer (#2693) 2019-03-22 10:48:55 -07:00
Menghan Li d7d977965e
grpclb: support pickfirst (#2652)
Use pickfirst as balancing policy for backends. It can only set at init time.
Does not support changing with service config now.
2019-03-19 10:17:31 -07:00
Menghan Li 69e99ca520
grpclb: keep drop index unless a new serverlist is received (#2631)
Keep the drop index from the previous picker when regenerating picker due to
subchannel state change. Only reset the drop index when picker is regenerated
because of a serverlist update.

fixes #2623
2019-03-11 10:09:16 -07:00
Menghan Li 9ecb6116ff
grpclb: drop only when at least one SubConn is ready (#2630) 2019-02-28 13:11:23 -08:00
Menghan Li 40cb5618f4
dialOption: export WithContextDialer() (#2629)
fixes #2627
2019-02-25 15:22:10 -08:00
CodeLingo Bot c2f12b83a7 Fix error formatting based on best practices from Code Review Comments (#2615) 2019-02-07 10:01:40 -08:00
Doug Fawley 59acad4c45
cleanup: more simplifications (#2574) 2019-01-16 13:07:56 -08:00
Can Guler 29a7ac4deb
client: deprecates FailFast & replaces its use by WaitForReady. 2018-12-13 15:15:11 -08:00
Menghan Li 191cc8e37b
grpclb: filter out grpclb addresses if balancer in use is not grpclb (#2509) 2018-12-13 10:54:42 -08:00
Doug Fawley 04ea82009c
cleanup: replace "x/net/context" import with "context" (#2439) 2018-11-12 13:30:41 -08:00
dfawley 90f728eaf7
Remove shadowing of built-ins (#2290) 2018-09-05 09:05:40 -07:00
Menghan Li aa30531d2b
grpclb: remove redundent testing struct (#2126)
Remove `rpcStatsForTest` and reuse `rpcStats` in tests.

Also fix races: https://travis-ci.org/grpc/grpc-go/jobs/388477002
2018-06-12 11:29:05 -07:00
Carl Mastrangelo dc86fffc26
Normalize gRPC LB 2018-06-11 17:52:20 -07:00
Jean de Klerk 0e5a36b652
internal: move leakcheck to internal/ (#2129)
internal: move leakcheck to internal/
2018-06-07 16:57:56 -07:00
Menghan Li 629f6bc5e5
grpclb: minor fixes on comments and tests (#2122)
* modify noimport.go panic message
* package level comments
* remove useless error check at grpclb_test.go:343
2018-06-05 13:52:07 -07:00
Carl Mastrangelo 4344c204c9 Split grpclb out of top level grpc package (#2107)
This PR splits out grpclb from grpc.  I have made the PR in several commits so you can see more clearly the steps that happened.

There are a few possibly contentious points that I would like to make clear up front:

* grpclb will no longer autoload as a load balancer.  I think this is okay, as service config is not widely (at all?) used, and I believe this is the only way to access it.
* `internal` is used more, as a way of having code shared between packages without exposing types
* ConnectivityStateEvaluator, as used by grpclb, is no longer thread safe.  I believe there is an outer mutex that guards access, but I want to point out this subtle change up here.

All but one tests pass with this, due to another cyclic dependency.  I can fix this, but it is a little more widely scoped (such as exposing grpc.server and grpc.errorDesc in the internal package).   This PR is a nearly-passing sample of that last step to get this working. 

PTAL @menghanl @dfawley
2018-06-05 09:54:12 -07:00