Skip to content

Commit 03b2ebe

Browse files
authored
xds: enable ringhash and retry by default (#4776)
1 parent b186ee8 commit 03b2ebe

File tree

3 files changed

+5
-85
lines changed

3 files changed

+5
-85
lines changed

.github/workflows/testing.yml

-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ jobs:
4747
goversion: 1.17
4848
testflags: -race
4949

50-
- type: tests
51-
goversion: 1.17
52-
grpcenv: GRPC_XDS_EXPERIMENTAL_ENABLE_RETRY=true
53-
5450
- type: extras
5551
goversion: 1.17
5652

internal/xds/env/env.go

+5-17
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ var (
6262
// When both bootstrap FileName and FileContent are set, FileName is used.
6363
BootstrapFileContent = os.Getenv(BootstrapFileContentEnv)
6464
// RingHashSupport indicates whether ring hash support is enabled, which can
65-
// be enabled by setting the environment variable
66-
// "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "true".
67-
RingHashSupport = strings.EqualFold(os.Getenv(ringHashSupportEnv), "true")
65+
// be disabled by setting the environment variable
66+
// "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "false".
67+
RingHashSupport = !strings.EqualFold(os.Getenv(ringHashSupportEnv), "false")
6868
// ClientSideSecuritySupport is used to control processing of security
6969
// configuration on the client-side.
7070
//
7171
// Note that there is no env var protection for the server-side because we
7272
// have a brand new API on the server-side and users explicitly need to use
7373
// the new API to get security integration on the server.
74-
ClientSideSecuritySupport = strings.EqualFold(os.Getenv(clientSideSecuritySupportEnv), "true")
74+
ClientSideSecuritySupport = !strings.EqualFold(os.Getenv(clientSideSecuritySupportEnv), "false")
7575
// AggregateAndDNSSupportEnv indicates whether processing of aggregated
7676
// cluster and DNS cluster is enabled, which can be enabled by setting the
7777
// environment variable
@@ -80,7 +80,7 @@ var (
8080
AggregateAndDNSSupportEnv = strings.EqualFold(os.Getenv(aggregateAndDNSSupportEnv), "true")
8181

8282
// RetrySupport indicates whether xDS retry is enabled.
83-
RetrySupport = strings.EqualFold(os.Getenv(retrySupportEnv), "true")
83+
RetrySupport = !strings.EqualFold(os.Getenv(retrySupportEnv), "false")
8484

8585
// C2PResolverSupport indicates whether support for C2P resolver is enabled.
8686
// This can be enabled by setting the environment variable
@@ -89,15 +89,3 @@ var (
8989
// C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing.
9090
C2PResolverTestOnlyTrafficDirectorURI = os.Getenv(c2pResolverTestOnlyTrafficDirectorURIEnv)
9191
)
92-
93-
func init() {
94-
// Set the env var used to control processing of security configuration on
95-
// the client-side to true by default.
96-
// TODO(easwars): Remove this env var completely in 1.42.x release.
97-
//
98-
// If the env var is set explicitly, honor it.
99-
ClientSideSecuritySupport = true
100-
if val, ok := os.LookupEnv(clientSideSecuritySupportEnv); ok {
101-
ClientSideSecuritySupport = strings.EqualFold(val, "true")
102-
}
103-
}

test/retry_test.go

-64
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"fmt"
2424
"io"
2525
"net"
26-
"os"
2726
"reflect"
2827
"strconv"
2928
"strings"
@@ -116,69 +115,6 @@ func (s) TestRetryUnary(t *testing.T) {
116115
}
117116
}
118117

119-
func (s) TestRetryDisabledByDefault(t *testing.T) {
120-
if strings.EqualFold(os.Getenv("GRPC_GO_RETRY"), "on") ||
121-
strings.EqualFold(os.Getenv("GRPC_XDS_EXPERIMENTAL_ENABLE_RETRY"), "true") {
122-
return
123-
}
124-
i := -1
125-
ss := &stubserver.StubServer{
126-
EmptyCallF: func(context.Context, *testpb.Empty) (*testpb.Empty, error) {
127-
i++
128-
switch i {
129-
case 0:
130-
return nil, status.New(codes.AlreadyExists, "retryable error").Err()
131-
}
132-
return &testpb.Empty{}, nil
133-
},
134-
}
135-
if err := ss.Start([]grpc.ServerOption{}); err != nil {
136-
t.Fatalf("Error starting endpoint server: %v", err)
137-
}
138-
defer ss.Stop()
139-
ss.NewServiceConfig(`{
140-
"methodConfig": [{
141-
"name": [{"service": "grpc.testing.TestService"}],
142-
"waitForReady": true,
143-
"retryPolicy": {
144-
"MaxAttempts": 4,
145-
"InitialBackoff": ".01s",
146-
"MaxBackoff": ".01s",
147-
"BackoffMultiplier": 1.0,
148-
"RetryableStatusCodes": [ "ALREADY_EXISTS" ]
149-
}
150-
}]}`)
151-
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
152-
for {
153-
if ctx.Err() != nil {
154-
t.Fatalf("Timed out waiting for service config update")
155-
}
156-
if ss.CC.GetMethodConfig("/grpc.testing.TestService/EmptyCall").WaitForReady != nil {
157-
break
158-
}
159-
time.Sleep(time.Millisecond)
160-
}
161-
cancel()
162-
163-
testCases := []struct {
164-
code codes.Code
165-
count int
166-
}{
167-
{codes.AlreadyExists, 0},
168-
}
169-
for _, tc := range testCases {
170-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
171-
_, err := ss.Client.EmptyCall(ctx, &testpb.Empty{})
172-
cancel()
173-
if status.Code(err) != tc.code {
174-
t.Fatalf("EmptyCall(_, _) = _, %v; want _, <Code() = %v>", err, tc.code)
175-
}
176-
if i != tc.count {
177-
t.Fatalf("i = %v; want %v", i, tc.count)
178-
}
179-
}
180-
}
181-
182118
func (s) TestRetryThrottling(t *testing.T) {
183119
defer enableRetry()()
184120
i := -1

0 commit comments

Comments
 (0)