Skip to content

Commit 778860e

Browse files
authored
testing: update Go to 1.19 (#5717)
1 parent eb8aa31 commit 778860e

File tree

94 files changed

+570
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+570
-503
lines changed

.github/workflows/testing.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Go
2525
uses: actions/setup-go@v2
2626
with:
27-
go-version: 1.18
27+
go-version: 1.19
2828
- name: Checkout repo
2929
uses: actions/checkout@v2
3030

@@ -44,31 +44,31 @@ jobs:
4444
matrix:
4545
include:
4646
- type: vet+tests
47-
goversion: 1.18
47+
goversion: 1.19
4848

4949
- type: tests
50-
goversion: 1.18
50+
goversion: 1.19
5151
testflags: -race
5252

5353
- type: tests
54-
goversion: 1.18
54+
goversion: 1.19
5555
goarch: 386
5656

5757
- type: tests
58-
goversion: 1.18
58+
goversion: 1.19
5959
goarch: arm64
6060

6161
- type: tests
62-
goversion: 1.17
62+
goversion: 1.18
6363

6464
- type: tests
65-
goversion: 1.16
65+
goversion: 1.17
6666

6767
- type: tests
68-
goversion: 1.15
68+
goversion: 1.16
6969

7070
- type: extras
71-
goversion: 1.18
71+
goversion: 1.19
7272

7373
steps:
7474
# Setup the environment.

admin/admin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//
2424
// - CSDS: https://github.com/grpc/proposal/blob/master/A40-csds-support.md
2525
//
26-
// Experimental
26+
// # Experimental
2727
//
2828
// Notice: All APIs in this package are experimental and may be removed in a
2929
// later release.

attributes/attributes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// Package attributes defines a generic key/value store used in various gRPC
2020
// components.
2121
//
22-
// Experimental
22+
// # Experimental
2323
//
2424
// Notice: This package is EXPERIMENTAL and may be changed or removed in a
2525
// later release.

authz/rbac_translator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Package authz exposes methods to manage authorization within gRPC.
1818
//
19-
// Experimental
19+
// # Experimental
2020
//
2121
// Notice: This package is EXPERIMENTAL and may be changed or removed
2222
// in a later release.

backoff.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type BackoffConfig struct {
4848
// here for more details:
4949
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
5050
//
51-
// Experimental
51+
// # Experimental
5252
//
5353
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
5454
// later release.

balancer/base/balancer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ func (b *baseBalancer) mergeErrors() error {
157157

158158
// regeneratePicker takes a snapshot of the balancer, and generates a picker
159159
// from it. The picker is
160-
// - errPicker if the balancer is in TransientFailure,
161-
// - built by the pickerBuilder with all READY SubConns otherwise.
160+
// - errPicker if the balancer is in TransientFailure,
161+
// - built by the pickerBuilder with all READY SubConns otherwise.
162162
func (b *baseBalancer) regeneratePicker() {
163163
if b.state == connectivity.TransientFailure {
164164
b.picker = NewErrPicker(b.mergeErrors())

balancer/conn_state_evaluator.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ type ConnectivityStateEvaluator struct {
3434
// RecordTransition records state change happening in subConn and based on that
3535
// it evaluates what aggregated state should be.
3636
//
37-
// - If at least one SubConn in Ready, the aggregated state is Ready;
38-
// - Else if at least one SubConn in Connecting, the aggregated state is Connecting;
39-
// - Else if at least one SubConn is Idle, the aggregated state is Idle;
40-
// - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure.
37+
// - If at least one SubConn in Ready, the aggregated state is Ready;
38+
// - Else if at least one SubConn in Connecting, the aggregated state is Connecting;
39+
// - Else if at least one SubConn is Idle, the aggregated state is Idle;
40+
// - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure.
4141
//
4242
// Shutdown is not considered.
4343
func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State {

balancer/grpclb/grpc_lb_v1/load_balancer.pb.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

balancer/grpclb/grpclb.go

+13-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
// Package grpclb defines a grpclb balancer.
2020
//
2121
// To install grpclb balancer, import this package as:
22-
// import _ "google.golang.org/grpc/balancer/grpclb"
22+
//
23+
// import _ "google.golang.org/grpc/balancer/grpclb"
2324
package grpclb
2425

2526
import (
@@ -229,8 +230,9 @@ type lbBalancer struct {
229230

230231
// regeneratePicker takes a snapshot of the balancer, and generates a picker from
231232
// it. The picker
232-
// - always returns ErrTransientFailure if the balancer is in TransientFailure,
233-
// - does two layer roundrobin pick otherwise.
233+
// - always returns ErrTransientFailure if the balancer is in TransientFailure,
234+
// - does two layer roundrobin pick otherwise.
235+
//
234236
// Caller must hold lb.mu.
235237
func (lb *lbBalancer) regeneratePicker(resetDrop bool) {
236238
if lb.state == connectivity.TransientFailure {
@@ -290,14 +292,14 @@ func (lb *lbBalancer) regeneratePicker(resetDrop bool) {
290292
// fallback and grpclb). lb.scState contains states for all SubConns, including
291293
// those in cache (SubConns are cached for 10 seconds after remove).
292294
//
293-
// The aggregated state is:
294-
// - If at least one SubConn in Ready, the aggregated state is Ready;
295-
// - Else if at least one SubConn in Connecting or IDLE, the aggregated state is Connecting;
296-
// - It's OK to consider IDLE as Connecting. SubConns never stay in IDLE,
297-
// they start to connect immediately. But there's a race between the overall
298-
// state is reported, and when the new SubConn state arrives. And SubConns
299-
// never go back to IDLE.
300-
// - Else the aggregated state is TransientFailure.
295+
// The aggregated state is:
296+
// - If at least one SubConn in Ready, the aggregated state is Ready;
297+
// - Else if at least one SubConn in Connecting or IDLE, the aggregated state is Connecting;
298+
// - It's OK to consider IDLE as Connecting. SubConns never stay in IDLE,
299+
// they start to connect immediately. But there's a race between the overall
300+
// state is reported, and when the new SubConn state arrives. And SubConns
301+
// never go back to IDLE.
302+
// - Else the aggregated state is TransientFailure.
301303
func (lb *lbBalancer) aggregateSubConnStates() connectivity.State {
302304
var numConnecting uint64
303305

balancer/rls/balancer.go

+11-12
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ func (b *rlsBalancer) ExitIdle() {
426426

427427
// sendNewPickerLocked pushes a new picker on to the channel.
428428
//
429-
//
430429
// Note that regardless of what connectivity state is reported, the policy will
431430
// return its own picker, and not a picker that unconditionally queues
432431
// (typically used for IDLE or CONNECTING) or a picker that unconditionally
@@ -485,14 +484,14 @@ func (b *rlsBalancer) sendNewPicker() {
485484
}
486485

487486
// The aggregated connectivity state reported is determined as follows:
488-
// - If there is at least one child policy in state READY, the connectivity
489-
// state is READY.
490-
// - Otherwise, if there is at least one child policy in state CONNECTING, the
491-
// connectivity state is CONNECTING.
492-
// - Otherwise, if there is at least one child policy in state IDLE, the
493-
// connectivity state is IDLE.
494-
// - Otherwise, all child policies are in TRANSIENT_FAILURE, and the
495-
// connectivity state is TRANSIENT_FAILURE.
487+
// - If there is at least one child policy in state READY, the connectivity
488+
// state is READY.
489+
// - Otherwise, if there is at least one child policy in state CONNECTING, the
490+
// connectivity state is CONNECTING.
491+
// - Otherwise, if there is at least one child policy in state IDLE, the
492+
// connectivity state is IDLE.
493+
// - Otherwise, all child policies are in TRANSIENT_FAILURE, and the
494+
// connectivity state is TRANSIENT_FAILURE.
496495
//
497496
// If the RLS policy has no child policies and no configured default target,
498497
// then we will report connectivity state IDLE.
@@ -542,9 +541,9 @@ func (b *rlsBalancer) UpdateState(id string, state balancer.State) {
542541
// This method is invoked by the BalancerGroup whenever a child policy sends a
543542
// state update. We cache the child policy's connectivity state and picker for
544543
// two reasons:
545-
// - to suppress connectivity state transitions from TRANSIENT_FAILURE to states
546-
// other than READY
547-
// - to delegate picks to child policies
544+
// - to suppress connectivity state transitions from TRANSIENT_FAILURE to states
545+
// other than READY
546+
// - to delegate picks to child policies
548547
func (b *rlsBalancer) handleChildPolicyStateUpdate(id string, newState balancer.State) {
549548
b.stateMu.Lock()
550549
defer b.stateMu.Unlock()

balancer/rls/config.go

+30-27
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,36 @@ type lbConfigJSON struct {
113113
// ParseConfig parses the JSON load balancer config provided into an
114114
// internal form or returns an error if the config is invalid.
115115
//
116-
// When parsing a config update, the following validations are performed:
117-
// - routeLookupConfig:
118-
// - grpc_keybuilders field:
119-
// - must have at least one entry
120-
// - must not have two entries with the same `Name`
121-
// - within each entry:
122-
// - must have at least one `Name`
123-
// - must not have a `Name` with the `service` field unset or empty
124-
// - within each `headers` entry:
125-
// - must not have `required_match` set
126-
// - must not have `key` unset or empty
127-
// - across all `headers`, `constant_keys` and `extra_keys` fields:
128-
// - must not have the same `key` specified twice
129-
// - no `key` must be the empty string
130-
// - `lookup_service` field must be set and must parse as a target URI
131-
// - if `max_age` > 5m, it should be set to 5 minutes
132-
// - if `stale_age` > `max_age`, ignore it
133-
// - if `stale_age` is set, then `max_age` must also be set
134-
// - ignore `valid_targets` field
135-
// - `cache_size_bytes` field must have a value greater than 0, and if its
136-
// value is greater than 5M, we cap it at 5M
137-
// - routeLookupChannelServiceConfig:
138-
// - if specified, must parse as valid service config
139-
// - childPolicy:
140-
// - must find a valid child policy with a valid config
141-
// - childPolicyConfigTargetFieldName:
142-
// - must be set and non-empty
116+
// When parsing a config update, the following validations are performed:
117+
// - routeLookupConfig:
118+
// - grpc_keybuilders field:
119+
// - must have at least one entry
120+
// - must not have two entries with the same `Name`
121+
// - within each entry:
122+
// - must have at least one `Name`
123+
// - must not have a `Name` with the `service` field unset or empty
124+
// - within each `headers` entry:
125+
// - must not have `required_match` set
126+
// - must not have `key` unset or empty
127+
// - across all `headers`, `constant_keys` and `extra_keys` fields:
128+
// - must not have the same `key` specified twice
129+
// - no `key` must be the empty string
130+
// - `lookup_service` field must be set and must parse as a target URI
131+
// - if `max_age` > 5m, it should be set to 5 minutes
132+
// - if `stale_age` > `max_age`, ignore it
133+
// - if `stale_age` is set, then `max_age` must also be set
134+
// - ignore `valid_targets` field
135+
// - `cache_size_bytes` field must have a value greater than 0, and if its
136+
// value is greater than 5M, we cap it at 5M
137+
//
138+
// - routeLookupChannelServiceConfig:
139+
// - if specified, must parse as valid service config
140+
//
141+
// - childPolicy:
142+
// - must find a valid child policy with a valid config
143+
//
144+
// - childPolicyConfigTargetFieldName:
145+
// - must be set and non-empty
143146
func (rlsBB) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, error) {
144147
logger.Infof("Received JSON service config: %v", pretty.ToJSON(c))
145148
cfgJSON := &lbConfigJSON{}

balancer/rls/helpers_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ func startManualResolverWithConfig(t *testing.T, rlsConfig *e2e.RLSConfig) *manu
220220
//
221221
// There are many instances where it can take a while before the attempted RPC
222222
// reaches the expected backend. Examples include, but are not limited to:
223-
// - control channel is changed in a config update. The RLS LB policy creates a
224-
// new control channel, and sends a new picker to gRPC. But it takes a while
225-
// before gRPC actually starts using the new picker.
226-
// - test is waiting for a cache entry to expire after which we expect a
227-
// different behavior because we have configured the fake RLS server to return
228-
// different backends.
223+
// - control channel is changed in a config update. The RLS LB policy creates a
224+
// new control channel, and sends a new picker to gRPC. But it takes a while
225+
// before gRPC actually starts using the new picker.
226+
// - test is waiting for a cache entry to expire after which we expect a
227+
// different behavior because we have configured the fake RLS server to return
228+
// different backends.
229229
//
230230
// Therefore, we do not return an error when the RPC fails. Instead, we wait for
231231
// the context to expire before failing.

balancer/rls/internal/adaptive/adaptive.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ const (
4545
// The throttler has the following knobs for which we will use defaults for
4646
// now. If there is a need to make them configurable at a later point in time,
4747
// support for the same will be added.
48-
// * Duration: amount of recent history that will be taken into account for
49-
// making client-side throttling decisions. A default of 30 seconds is used.
50-
// * Bins: number of bins to be used for bucketing historical data. A default
51-
// of 100 is used.
52-
// * RatioForAccepts: ratio by which accepts are multiplied, typically a value
53-
// slightly larger than 1.0. This is used to make the throttler behave as if
54-
// the backend had accepted more requests than it actually has, which lets us
55-
// err on the side of sending to the backend more requests than we think it
56-
// will accept for the sake of speeding up the propagation of state. A
57-
// default of 2.0 is used.
58-
// * RequestsPadding: is used to decrease the (client-side) throttling
59-
// probability in the low QPS regime (to speed up propagation of state), as
60-
// well as to safeguard against hitting a client-side throttling probability
61-
// of 100%. The weight of this value decreases as the number of requests in
62-
// recent history grows. A default of 8 is used.
48+
// - Duration: amount of recent history that will be taken into account for
49+
// making client-side throttling decisions. A default of 30 seconds is used.
50+
// - Bins: number of bins to be used for bucketing historical data. A default
51+
// of 100 is used.
52+
// - RatioForAccepts: ratio by which accepts are multiplied, typically a value
53+
// slightly larger than 1.0. This is used to make the throttler behave as if
54+
// the backend had accepted more requests than it actually has, which lets us
55+
// err on the side of sending to the backend more requests than we think it
56+
// will accept for the sake of speeding up the propagation of state. A
57+
// default of 2.0 is used.
58+
// - RequestsPadding: is used to decrease the (client-side) throttling
59+
// probability in the low QPS regime (to speed up propagation of state), as
60+
// well as to safeguard against hitting a client-side throttling probability
61+
// of 100%. The weight of this value decreases as the number of requests in
62+
// recent history grows. A default of 8 is used.
6363
//
6464
// The adaptive throttler attempts to estimate the probability that a request
6565
// will be throttled using recent history. Server requests (both throttled and

balancer/weightedroundrobin/weightedroundrobin.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (a AddrInfo) Equal(o interface{}) bool {
4545
// SetAddrInfo returns a copy of addr in which the BalancerAttributes field is
4646
// updated with addrInfo.
4747
//
48-
// Experimental
48+
// # Experimental
4949
//
5050
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
5151
// later release.
@@ -57,7 +57,7 @@ func SetAddrInfo(addr resolver.Address, addrInfo AddrInfo) resolver.Address {
5757
// GetAddrInfo returns the AddrInfo stored in the BalancerAttributes field of
5858
// addr.
5959
//
60-
// Experimental
60+
// # Experimental
6161
//
6262
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
6363
// later release.

benchmark/benchmain/main.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,22 @@ Package main provides benchmark with setting flags.
2121
2222
An example to run some benchmarks with profiling enabled:
2323
24-
go run benchmark/benchmain/main.go -benchtime=10s -workloads=all \
25-
-compression=gzip -maxConcurrentCalls=1 -trace=off \
26-
-reqSizeBytes=1,1048576 -respSizeBytes=1,1048576 -networkMode=Local \
27-
-cpuProfile=cpuProf -memProfile=memProf -memProfileRate=10000 -resultFile=result
24+
go run benchmark/benchmain/main.go -benchtime=10s -workloads=all \
25+
-compression=gzip -maxConcurrentCalls=1 -trace=off \
26+
-reqSizeBytes=1,1048576 -respSizeBytes=1,1048576 -networkMode=Local \
27+
-cpuProfile=cpuProf -memProfile=memProf -memProfileRate=10000 -resultFile=result
2828
2929
As a suggestion, when creating a branch, you can run this benchmark and save the result
3030
file "-resultFile=basePerf", and later when you at the middle of the work or finish the
3131
work, you can get the benchmark result and compare it with the base anytime.
3232
3333
Assume there are two result files names as "basePerf" and "curPerf" created by adding
3434
-resultFile=basePerf and -resultFile=curPerf.
35-
To format the curPerf, run:
36-
go run benchmark/benchresult/main.go curPerf
37-
To observe how the performance changes based on a base result, run:
38-
go run benchmark/benchresult/main.go basePerf curPerf
35+
36+
To format the curPerf, run:
37+
go run benchmark/benchresult/main.go curPerf
38+
To observe how the performance changes based on a base result, run:
39+
go run benchmark/benchresult/main.go basePerf curPerf
3940
*/
4041
package main
4142

0 commit comments

Comments
 (0)