Skip to content

Commit 594c411

Browse files
committed
save changes.
1 parent 5a63438 commit 594c411

File tree

3 files changed

+5
-160
lines changed

3 files changed

+5
-160
lines changed

examples/example-jwt-auth/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dependencies {
4444
protobuf {
4545
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
4646
plugins {
47-
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
47+
grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.73.0" }
4848
}
4949
generateProtoTasks {
5050
all()*.plugins { grpc {} }

netty/src/main/java/io/grpc/netty/NettyClientTransport.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,6 @@
1616

1717
package io.grpc.netty;
1818

19-
import static io.grpc.internal.GrpcUtil.KEEPALIVE_TIME_NANOS_DISABLED;
20-
import static io.netty.channel.ChannelOption.ALLOCATOR;
21-
import static io.netty.channel.ChannelOption.SO_KEEPALIVE;
22-
23-
import com.google.common.annotations.VisibleForTesting;
24-
import com.google.common.base.MoreObjects;
25-
import com.google.common.base.Preconditions;
26-
import com.google.common.base.Ticker;
27-
import com.google.common.util.concurrent.ListenableFuture;
28-
import com.google.common.util.concurrent.SettableFuture;
29-
import io.grpc.Attributes;
30-
import io.grpc.CallOptions;
31-
import io.grpc.ChannelLogger;
32-
import io.grpc.ClientStreamTracer;
33-
import io.grpc.InternalChannelz.SocketStats;
34-
import io.grpc.InternalLogId;
35-
import io.grpc.Metadata;
36-
import io.grpc.MethodDescriptor;
37-
import io.grpc.Status;
38-
import io.grpc.internal.ClientStream;
39-
import io.grpc.internal.ConnectionClientTransport;
40-
import io.grpc.internal.FailingClientStream;
41-
import io.grpc.internal.GrpcUtil;
42-
import io.grpc.internal.Http2Ping;
43-
import io.grpc.internal.KeepAliveManager;
44-
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
45-
import io.grpc.internal.StatsTraceContext;
46-
import io.grpc.internal.TransportTracer;
47-
import io.grpc.netty.NettyChannelBuilder.LocalSocketPicker;
48-
import io.netty.bootstrap.Bootstrap;
49-
import io.netty.channel.Channel;
50-
import io.netty.channel.ChannelFactory;
51-
import io.netty.channel.ChannelFuture;
52-
import io.netty.channel.ChannelFutureListener;
53-
import io.netty.channel.ChannelHandler;
54-
import io.netty.channel.ChannelOption;
55-
import io.netty.channel.EventLoop;
56-
import io.netty.channel.EventLoopGroup;
57-
import io.netty.handler.codec.http2.StreamBufferingEncoder.Http2ChannelClosedException;
58-
import io.netty.util.AsciiString;
59-
import io.netty.util.concurrent.Future;
60-
import io.netty.util.concurrent.GenericFutureListener;
61-
import java.net.SocketAddress;
62-
import java.nio.channels.ClosedChannelException;
63-
import java.util.Map;
64-
import java.util.concurrent.Executor;
65-
import java.util.concurrent.TimeUnit;
66-
import javax.annotation.Nullable;
6719

6820
/**
6921
* A Netty-based {@link ConnectionClientTransport} implementation.

xds/src/main/java/io/grpc/xds/CdsLoadBalancer2.java

Lines changed: 4 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private void shutdown() {
144144
}
145145
}
146146

147-
private void handleClusterDiscovered2() {
147+
private void handleClusterDiscovered() {
148148
if (root.isLeaf) {
149149
DiscoveryMechanism instance;
150150
if (root.result.clusterType() == ClusterType.EDS) {
@@ -201,6 +201,8 @@ private void handleClusterDiscovered2() {
201201
continue;
202202
}
203203
if (clusterState.isLeaf) {
204+
numLeafClusters++;
205+
} else {
204206
if (clusterState.childClusterStates == null) {
205207
continue;
206208
}
@@ -234,7 +236,7 @@ private void handleClusterDiscovered2() {
234236
return;
235237
}
236238

237-
if (instances.isEmpty()) { // none of non-aggregate clusters exists
239+
if (numLeafClusters == 0) { // none of non-aggregate clusters exists
238240
if (childLb != null) {
239241
childLb.shutdown();
240242
childLb = null;
@@ -271,115 +273,6 @@ private void handleClusterDiscovered2() {
271273
}
272274
}
273275

274-
private void handleClusterDiscovered() {
275-
List<DiscoveryMechanism> instances = new ArrayList<>();
276-
277-
// Used for loop detection to break the infinite recursion that loops would cause
278-
Map<ClusterState, List<ClusterState>> parentClusters = new HashMap<>();
279-
Status loopStatus = null;
280-
281-
// Level-order traversal.
282-
// Collect configurations for all non-aggregate (leaf) clusters.
283-
Queue<ClusterState> queue = new ArrayDeque<>();
284-
queue.add(root);
285-
while (!queue.isEmpty()) {
286-
int size = queue.size();
287-
for (int i = 0; i < size; i++) {
288-
ClusterState clusterState = queue.remove();
289-
if (!clusterState.discovered) {
290-
return; // do not proceed until all clusters discovered
291-
}
292-
if (clusterState.result == null) { // resource revoked or not exists
293-
continue;
294-
}
295-
if (clusterState.isLeaf) {
296-
if (instances.stream().map(inst -> inst.cluster).noneMatch(clusterState.name::equals)) {
297-
DiscoveryMechanism instance;
298-
if (clusterState.result.clusterType() == ClusterType.EDS) {
299-
instance = DiscoveryMechanism.forEds(
300-
clusterState.name, clusterState.result.edsServiceName(),
301-
clusterState.result.lrsServerInfo(),
302-
clusterState.result.maxConcurrentRequests(),
303-
clusterState.result.upstreamTlsContext(),
304-
clusterState.result.filterMetadata(),
305-
clusterState.result.outlierDetection());
306-
} else { // logical DNS
307-
instance = DiscoveryMechanism.forLogicalDns(
308-
clusterState.name, clusterState.result.dnsHostName(),
309-
clusterState.result.lrsServerInfo(),
310-
clusterState.result.maxConcurrentRequests(),
311-
clusterState.result.upstreamTlsContext(),
312-
clusterState.result.filterMetadata());
313-
}
314-
instances.add(instance);
315-
}
316-
} else {
317-
if (clusterState.childClusterStates == null) {
318-
continue;
319-
}
320-
// Do loop detection and break recursion if detected
321-
List<String> namesCausingLoops = identifyLoops(clusterState, parentClusters);
322-
if (namesCausingLoops.isEmpty()) {
323-
queue.addAll(clusterState.childClusterStates.values());
324-
} else {
325-
// Do cleanup
326-
if (childLb != null) {
327-
childLb.shutdown();
328-
childLb = null;
329-
}
330-
if (loopStatus != null) {
331-
logger.log(XdsLogLevel.WARNING,
332-
"Multiple loops in CDS config. Old msg: " + loopStatus.getDescription());
333-
}
334-
loopStatus = Status.UNAVAILABLE.withDescription(String.format(
335-
"CDS error: circular aggregate clusters directly under %s for "
336-
+ "root cluster %s, named %s, xDS node ID: %s",
337-
clusterState.name, root.name, namesCausingLoops,
338-
xdsClient.getBootstrapInfo().node().getId()));
339-
}
340-
}
341-
}
342-
}
343-
344-
if (loopStatus != null) {
345-
helper.updateBalancingState(
346-
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(loopStatus)));
347-
return;
348-
}
349-
350-
if (instances.isEmpty()) { // none of non-aggregate clusters exists
351-
if (childLb != null) {
352-
childLb.shutdown();
353-
childLb = null;
354-
}
355-
Status unavailable = Status.UNAVAILABLE.withDescription(String.format(
356-
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster %s"
357-
+ " xDS node ID: %s", root.name, xdsClient.getBootstrapInfo().node().getId()));
358-
helper.updateBalancingState(
359-
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(unavailable)));
360-
return;
361-
}
362-
363-
// The LB policy config is provided in service_config.proto/JSON format.
364-
NameResolver.ConfigOrError configOrError =
365-
GracefulSwitchLoadBalancer.parseLoadBalancingPolicyConfig(
366-
Arrays.asList(root.result.lbPolicyConfig()), lbRegistry);
367-
if (configOrError.getError() != null) {
368-
throw configOrError.getError().augmentDescription("Unable to parse the LB config")
369-
.asRuntimeException();
370-
}
371-
372-
ClusterResolverConfig config = new ClusterResolverConfig(
373-
Collections.unmodifiableList(instances),
374-
configOrError.getConfig(),
375-
root.result.isHttp11ProxyAvailable());
376-
if (childLb == null) {
377-
childLb = lbRegistry.getProvider(CLUSTER_RESOLVER_POLICY_NAME).newLoadBalancer(helper);
378-
}
379-
childLb.handleResolvedAddresses(
380-
resolvedAddresses.toBuilder().setLoadBalancingPolicyConfig(config).build());
381-
}
382-
383276
/**
384277
* Returns children that would cause loops and builds up the parentClusters map.
385278
**/

0 commit comments

Comments
 (0)