This PR causes mergeable to enforce the following rules on PRs:
- must include a "Type:" label
- must include either the "no release notes" label or a Release milestone
* Added a test for keepalive dormancy.
* Added comments to all tests, explicitly stating their intention.
* Used the exported APIs wherever possible instead of relying on
internal state.
* Specifically checked for GoAway reason, instead of just relying on the
receipt of a goaway.
* Improved error messages printed upon test failures.
* Made the tests more consistent with each other in terms of variables
names, whitespace usage etc.
Once this PR is approved and merged, we can move all these tests to a
separate file.
Rename TestXdsBalanceHandleResolvedAddrs as TestXdsFallbackResolvedAddrs
and add comments to explain what the test is doing. Also added some
other comments and made minor formatting changes.
The current code was using a buffered channel which was used to signal
whether the keepalive goroutine should enter dormancy or if it should be
awaked from sleep. Using sync.Cond makes the code much simpler to read,
and also improves the performance numbers in all but one front.
Total number of Allocs and AllocedBytes retrieved from
runtime.Memstats() were not being divided by the number of completed
operations during the benchmark run, to get the correct number of
Allocs/op and Bytes/op.
This resolver doesn't do much at this point, except returning an empty
address list and a hard-coded service config which picks the xds
balancer with a round_robin child policy.
Also moved the xdsConfig struct to the xds/internal package and exported
it as LBConfig, so that both the resolver and the balancer packages can
make use of this.
We will have a root level xds/ directory which will eventually contain
all xDS implementation including balancer, resolver, client etc.
The new structure looks something like this:
grpc/
|
+--xds/
|
+--internal/
| |
| +--balancer/
| |
| +--edsbalancer/
| |
| +--lrs/
| |
| +--orca/
|
+--experimental/
Users need to import grpc/xds/experimental package to get all xds
functionality, and this will eventually be moved to grpc/xds.
Also, moved grpc/balancer/internal/wrr to grpc/internal/wrr.
The pickfirstBalancer and baseBalancer are logging a lot of messages under normal operation. Those messages can not be associated to a server connection because no connection address is part of the messages. They are messages that are only useful when debugging issues.
Only log them when the verbose level is at least 2, to reduce the amount of log messages under normal operation.
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.
Also, deprecate WithBalancerName (was experimental).
The decision of whether something may be removed is based on if it was marked experimental as of v1.0/GA or upon its introduction, in accordance with Documentation/versioning.md.
With pickfirst, the same SubConn is reused, only addresses are updated.
But backends and fallbacks may need different credentials. This change
force-removes all SubConns when switching fallback.