Skip to content

Commit

Permalink
xds: remove filter chain uuid name generator (grpc#8663)
Browse files Browse the repository at this point in the history
Generating a uuid in filterChain breaks the de-duplication detection which causes XdsServer to cycle connections, so removing it.
An empty name is now allowed. The name is currently only used for debug purpose.
  • Loading branch information
YifeiZhuang authored and dapengzhang0 committed Dec 2, 2021
1 parent 89652d7 commit 865ce18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions xds/src/main/java/io/grpc/xds/ClientXdsClient.java
Expand Up @@ -104,7 +104,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -383,14 +382,10 @@ static FilterChain parseFilterChain(
validateDownstreamTlsContext(downstreamTlsContextProto));
}

String name = proto.getName();
if (name.isEmpty()) {
name = UUID.randomUUID().toString();
}
FilterChainMatch filterChainMatch = parseFilterChainMatch(proto.getFilterChainMatch());
checkForUniqueness(uniqueSet, filterChainMatch);
return new FilterChain(
name,
proto.getName(),
filterChainMatch,
httpConnectionManager,
downstreamTlsContext,
Expand Down
2 changes: 1 addition & 1 deletion xds/src/main/java/io/grpc/xds/EnvoyServerProtoData.java
Expand Up @@ -314,7 +314,7 @@ public String toString() {
* Corresponds to Envoy proto message {@link io.envoyproxy.envoy.api.v2.listener.FilterChain}.
*/
public static final class FilterChain {
// Unique name for the FilterChain.
// possibly empty
private final String name;
// TODO(sanjaypujare): flatten structure by moving FilterChainMatch class members here.
private final FilterChainMatch filterChainMatch;
Expand Down
4 changes: 2 additions & 2 deletions xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java
Expand Up @@ -1466,7 +1466,7 @@ public void parseFilterChain_unsupportedFilter() throws ResourceInvalidException
}

@Test
public void parseFilterChain_noName_generatedUuid() throws ResourceInvalidException {
public void parseFilterChain_noName() throws ResourceInvalidException {
FilterChain filterChain1 =
FilterChain.newBuilder()
.setFilterChainMatch(FilterChainMatch.getDefaultInstance())
Expand All @@ -1492,7 +1492,7 @@ public void parseFilterChain_noName_generatedUuid() throws ResourceInvalidExcept
EnvoyServerProtoData.FilterChain parsedFilterChain2 = ClientXdsClient.parseFilterChain(
filterChain2, new HashSet<String>(), null, filterRegistry, null,
true /* does not matter */);
assertThat(parsedFilterChain1.getName()).isNotEqualTo(parsedFilterChain2.getName());
assertThat(parsedFilterChain1.getName()).isEqualTo(parsedFilterChain2.getName());
}


Expand Down

0 comments on commit 865ce18

Please sign in to comment.