Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ public ApiFunction<ManagedChannelBuilder, ManagedChannelBuilder> getChannelConfi
}

private static ImmutableMap<String, ?> getDefaultDirectPathServiceConfig() {
// When channel pooling is enabled, force the pick_first grpclb strategy.
// When channel pooling is enabled, force the pick_first strategy.
// This is necessary to avoid the multiplicative effect of creating channel pool with
// `poolSize` number of `ManagedChannel`s, each with a `subSetting` number of number of
// subchannels.
Expand All @@ -1431,13 +1431,8 @@ public ApiFunction<ManagedChannelBuilder, ManagedChannelBuilder> getChannelConfi
ImmutableMap<String, Object> pickFirstStrategy =
ImmutableMap.<String, Object>of("pick_first", ImmutableMap.of());

ImmutableMap<String, Object> childPolicy =
ImmutableMap.<String, Object>of("childPolicy", ImmutableList.of(pickFirstStrategy));

ImmutableMap<String, Object> grpcLbPolicy =
ImmutableMap.<String, Object>of("grpclb", childPolicy);

return ImmutableMap.<String, Object>of("loadBalancingConfig", ImmutableList.of(grpcLbPolicy));
return ImmutableMap.<String, Object>of(
"loadBalancingConfig", ImmutableList.of(pickFirstStrategy));
}

private static void validateEndpoint(String endpoint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void testToBuilder() {
builder -> {
throw new UnsupportedOperationException();
};
Map<String, ?> directPathServiceConfig = ImmutableMap.of("loadbalancingConfig", "grpclb");
Map<String, ?> directPathServiceConfig = ImmutableMap.of("loadBalancingConfig", "pick_first");
List<InstantiatingGrpcChannelProvider.HardBoundTokenTypes> hardBoundTokenTypes =
new ArrayList<>();
hardBoundTokenTypes.add(InstantiatingGrpcChannelProvider.HardBoundTokenTypes.ALTS);
Expand Down Expand Up @@ -549,11 +549,7 @@ void testWithDefaultDirectPathServiceConfig() {
List<Map<String, ?>> lbConfigs = getAsObjectList(defaultServiceConfig, "loadBalancingConfig");
assertThat(lbConfigs).hasSize(1);
Map<String, ?> lbConfig = lbConfigs.get(0);
Map<String, ?> grpclb = getAsObject(lbConfig, "grpclb");
List<Map<String, ?>> childPolicies = getAsObjectList(grpclb, "childPolicy");
assertThat(childPolicies).hasSize(1);
Map<String, ?> childPolicy = childPolicies.get(0);
assertThat(childPolicy.keySet()).containsExactly("pick_first");
assertThat(lbConfig.keySet()).containsExactly("pick_first");
}

@Nullable
Expand Down Expand Up @@ -599,10 +595,10 @@ void testWithCustomDirectPathServiceConfig() {
ImmutableMap<String, Object> childPolicy =
ImmutableMap.<String, Object>of(
"childPolicy", ImmutableList.of(pickFirstStrategy), "foo", "bar");
ImmutableMap<String, Object> grpcLbPolicy =
ImmutableMap.<String, Object>of("grpclb", childPolicy);
ImmutableMap<String, Object> customLbPolicy =
ImmutableMap.<String, Object>of("my_custom_lb", childPolicy);
Map<String, Object> passedServiceConfig = new HashMap<>();
passedServiceConfig.put("loadBalancingConfig", ImmutableList.of(grpcLbPolicy));
passedServiceConfig.put("loadBalancingConfig", ImmutableList.of(customLbPolicy));

InstantiatingGrpcChannelProvider provider =
InstantiatingGrpcChannelProvider.newBuilder()
Expand Down
Loading