* Make healthcheck tests in end2end_test.go more readable.
- Made these tests use the default health service implementation
wherever possible.
- Refactored some common code used in these tests into helper functions.
- Added function comments for all these tests to improve readability.
In a follow up PR, I will be moving all these tests into
healthcheck_test.go.
For large messages this generates far less garbage than ioutil.ReadAll().
Implement for gzip - RFC1952 requires it, and the Go implementation
checks it already (modulo 2^32).
Add a RequestInfo struct which initially is used for passing the full request method (though could later be expanded to pass more info) so that things like GetRequestMetadata can be used to apply logic based on that data.
This is a fix for #3019
* Implement missing pieces for connection backoff.
Spec can be found here:
https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
Summary of changes:
* Added a new type (marked experimental), ConnectParams, which contains
the knobs defined in the spec (except for minConnectTimeout).
* Added a new API (marked experimental), WithConnectParams() to return a
DialOption to dial with the provided parameters.
* Added new fields to the implementation of the exponential backoff in
internal/backoff which mirror the ones in ConnectParams.
* Marked existing APIs WithBackoffMaxDelay() and WithBackoffConfig() as
deprecated.
* Added a default exponential backoff implementation, for easy use of
internal callers.
Added a new backoff package which defines the backoff configuration
options, and is used by both the grpc package and the internal/backoff
package. This allows us to have all backoff related options in a
separate package.
* Incorporate changes to bootstrap file format.
The format of the bootstrap file will be as follows:
{
"xds_server": {
"server_uri": <string containing URI of xds server>,
// List of channel creds; client will stop at the first type it
// supports.
"channel_creds": [
{
"type": <string containing channel cred type>,
// The "config" field is optional; it may be missing if the
// credential type does not require config parameters.
"config": <JSON object containing config for the type>
}
]
},
"node": <JSON form of Node proto>
}
- Also, the bootstrap file will be read everytime a new xDS client is created.
- Change NewConfig() to not return error. Instead it just returns with
certain fields left unspecified if it encounters errors.
- Do not fail the bootstrap process if we see unknown fields in the
bootstrap file.
This is a preparing change to support priority failover. It adds start() and close() to balancer group, so we can have a balancer group that's not in use, but has all the data and is ready to be started (think about a lower priority when the higher priority is in use).
A balancer group is split into two parts: static and dynamic:
static: the data from EDS, and gets updated even if balancer group is closed
balancer IDs and builders, addresses for each balancer
dynamic: the sub-balancers
These are only created when the balancer group is started. They are closed when the balancer group is closed.
And only when the balancer group is started, the sub-balancers will get address updates.
Previously this would fall into returning the same "s.header.Copy(), nil"
condition at the end of the function, returning an empty MD. After a recent
change it would instead check headerValid, which is always false on servers,
and return nil and an error. Callers were ignoring this error so no behavior
change was seen, but there is no need to check s.headers here.
`transport/Stream.RecvCompress` returns what the header contains, if present,
or empty string if a context error occurs. However, it "prefers" the header
data even if there is a context error, to prevent a related race. What happens
here is:
1. RPC starts.
2. Client cancels RPC.
3. `RecvCompress` tells `ClientStream.Recv` that compression used is "" because
of the context error. `as.decomp` is left nil, because there is no
compressor to look up in the registry.
4. Server's header and first message hit client.
5. Client sees the header and message and allows grpc's stream to see them.
(We only provide context errors if we need to block.)
6. Client performs a successful `Read` on the stream, receiving the gzipped
payload, then checks `as.decomp`.
7. We have no decompressor but the payload has a bit set indicating the message
is compressed, so this is an error. However, when forming the error string,
`RecvCompress` now returns "gzip" because it doesn't need to block to get
this from the now-received header. This leads to the confusing message
about how "gzip" is not installed even though it is.
This change makes `waitOnHeader` close the stream when context cancellation happens.
Then `RecvCompress` uses whatever value is present in the stream at that time, which
can no longer change because the stream is closed. Also, this will be in sync with
the messages on the stream - if there are any messages present, the headers must
have been processed first, and `RecvCompress` will contain the proper value.
In the event of a race, the first server may not be fully serving before the
client attempt to connect, then the second server may attempt to field the
FullDuplexCall, which it does not implement.
Fix the race by giving the client only the first server's address until after
the FullDuplexCall is started.
- Send a message from the test server that the client can block on to know for sure the RPC's header was sent.
- Don't receive in the test server so we can violate flow control
- Set a deadline on the RPC so it can't hang forever.
Also, two fixes:
- Fix long-standing `.travis.yml` bug where `VET_SKIP_PROTO` was not `export`ed (so not seen by `vet.sh`).
- Update `vet.sh` to work with new `goimports -l` that does not print a `:` after filenames.
As of this implementation, the bootstrap file will be provided in the
GRPC_XDS_BOOTSTRAP environment variable and will be read by the xDS
balancer. The file will be in JSON form with two top-level entities: a
Node proto and an ApiConfigSource proto. The overall JSON format will
be:
{
"node": <Node proto>,
"xds_server": <ApiConfigSource proto>
}
In the ApiConfigSource proto, We will support only one grpc_services
entry. The api_type field must be GRPC.
As for creds, we will use default TLS creds (which will use CAs from
system default directories, and will not use any client certificates)
for transport and default compute engine creds for call credentials.
This will evolve into something more configurable in the future.
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