Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xds: gate xDS timeout with env variable (v1.33.x backport) #7509

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions xds/src/main/java/io/grpc/xds/XdsNameResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ final class XdsNameResolver extends NameResolver {

static final CallOptions.Key<String> CLUSTER_SELECTION_KEY =
CallOptions.Key.create("io.grpc.xds.CLUSTER_SELECTION_KEY");
@VisibleForTesting
static boolean enableTimeout =
Boolean.parseBoolean(System.getenv("GRPC_XDS_EXPERIMENTAL_ENABLE_TIMEOUT"));

private final XdsLogger logger;
private final String authority;
Expand Down Expand Up @@ -242,9 +245,11 @@ public Result selectConfig(PickSubchannelArgs args) {
}
} while (!retainCluster(cluster));
// TODO(chengyuanzhang): avoid service config generation and parsing for each call.
Map<String, ?> rawServiceConfig =
generateServiceConfigWithMethodTimeoutConfig(
selectedRoute.getRouteAction().getTimeoutNano());
Map<String, ?> rawServiceConfig = Collections.emptyMap();
if (enableTimeout) {
rawServiceConfig = generateServiceConfigWithMethodTimeoutConfig(
selectedRoute.getRouteAction().getTimeoutNano());
}
ConfigOrError parsedServiceConfig = serviceConfigParser.parseServiceConfig(rawServiceConfig);
Object config = parsedServiceConfig.getConfig();
if (config == null) {
Expand Down
1 change: 1 addition & 0 deletions xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ XdsChannel createChannel(List<ServerInfo> servers) throws XdsInitializationExcep

@Before
public void setUp() {
XdsNameResolver.enableTimeout = true;
Bootstrapper bootstrapper = new Bootstrapper() {
@Override
public BootstrapInfo readBootstrap() {
Expand Down