mirror of https://github.com/grpc/grpc-java.git
xds: Non-SOTW resources need onError() callbacks, too (#12122)
SOTW is unique in that it can become absent after being found. But if we NACK when initially loading the resource, we don't want to delay, depend on the resource timeout, and then give a poor error. This was noticed while adding the EDS restriction that address is not a hostname and some tests started hanging instead of failing quickly.
This commit is contained in:
parent
48d08e643e
commit
efe9ccc22c
|
@ -592,12 +592,6 @@ public final class XdsClientImpl extends XdsClient implements ResourceStore {
|
||||||
subscriber.onRejected(args.versionInfo, updateTime, errorDetail);
|
subscriber.onRejected(args.versionInfo, updateTime, errorDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing else to do for incremental ADS resources.
|
|
||||||
if (!xdsResourceType.isFullStateOfTheWorld()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle State of the World ADS: invalid resources.
|
|
||||||
if (invalidResources.contains(resourceName)) {
|
if (invalidResources.contains(resourceName)) {
|
||||||
// The resource is missing. Reuse the cached resource if possible.
|
// The resource is missing. Reuse the cached resource if possible.
|
||||||
if (subscriber.data == null) {
|
if (subscriber.data == null) {
|
||||||
|
@ -607,6 +601,11 @@ public final class XdsClientImpl extends XdsClient implements ResourceStore {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nothing else to do for incremental ADS resources.
|
||||||
|
if (!xdsResourceType.isFullStateOfTheWorld()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// For State of the World services, notify watchers when their watched resource is missing
|
// For State of the World services, notify watchers when their watched resource is missing
|
||||||
// from the ADS update. Note that we can only do this if the resource update is coming from
|
// from the ADS update. Note that we can only do this if the resource update is coming from
|
||||||
// the same xDS server that the ResourceSubscriber is subscribed to.
|
// the same xDS server that the ResourceSubscriber is subscribed to.
|
||||||
|
|
|
@ -3270,6 +3270,8 @@ public abstract class GrpcXdsClientImplTestBase {
|
||||||
+ "locality:Locality{region=region2, zone=zone2, subZone=subzone2} for priority:1";
|
+ "locality:Locality{region=region2, zone=zone2, subZone=subzone2} for priority:1";
|
||||||
call.verifyRequestNack(EDS, EDS_RESOURCE, "", "0001", NODE, ImmutableList.of(
|
call.verifyRequestNack(EDS, EDS_RESOURCE, "", "0001", NODE, ImmutableList.of(
|
||||||
errorMsg));
|
errorMsg));
|
||||||
|
verify(edsResourceWatcher).onError(errorCaptor.capture());
|
||||||
|
assertThat(errorCaptor.getValue().getDescription()).contains(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue