|
|
@ -895,9 +895,15 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate( |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
"[xds_client %p] LDS update does not include requested resource", |
|
|
|
"[xds_client %p] LDS update does not include requested resource", |
|
|
|
xds_client()); |
|
|
|
xds_client()); |
|
|
|
xds_client()->service_config_watcher_->OnError( |
|
|
|
if (xds_client()->lds_result_.has_value() && |
|
|
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING( |
|
|
|
!xds_client()->lds_result_->route_config_name.empty()) { |
|
|
|
"LDS update does not include requested resource")); |
|
|
|
Unsubscribe(XdsApi::kRdsTypeUrl, |
|
|
|
|
|
|
|
xds_client()->lds_result_->route_config_name, |
|
|
|
|
|
|
|
/*delay_unsubscription=*/false); |
|
|
|
|
|
|
|
xds_client()->rds_result_.reset(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
xds_client()->lds_result_.reset(); |
|
|
|
|
|
|
|
xds_client()->service_config_watcher_->OnResourceDoesNotExist(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { |
|
|
@ -936,6 +942,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate( |
|
|
|
Unsubscribe( |
|
|
|
Unsubscribe( |
|
|
|
XdsApi::kRdsTypeUrl, xds_client()->lds_result_->route_config_name, |
|
|
|
XdsApi::kRdsTypeUrl, xds_client()->lds_result_->route_config_name, |
|
|
|
/*delay_unsubscription=*/!lds_update->route_config_name.empty()); |
|
|
|
/*delay_unsubscription=*/!lds_update->route_config_name.empty()); |
|
|
|
|
|
|
|
xds_client()->rds_result_.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
xds_client()->lds_result_ = std::move(lds_update); |
|
|
|
xds_client()->lds_result_ = std::move(lds_update); |
|
|
|
if (xds_client()->lds_result_->rds_update.has_value()) { |
|
|
|
if (xds_client()->lds_result_->rds_update.has_value()) { |
|
|
@ -963,9 +970,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate( |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
"[xds_client %p] RDS update does not include requested resource", |
|
|
|
"[xds_client %p] RDS update does not include requested resource", |
|
|
|
xds_client()); |
|
|
|
xds_client()); |
|
|
|
xds_client()->service_config_watcher_->OnError( |
|
|
|
xds_client()->rds_result_.reset(); |
|
|
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING( |
|
|
|
xds_client()->service_config_watcher_->OnResourceDoesNotExist(); |
|
|
|
"RDS update does not include requested resource")); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { |
|
|
@ -1051,20 +1057,20 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// For any subscribed resource that is not present in the update,
|
|
|
|
// For any subscribed resource that is not present in the update,
|
|
|
|
// remove it from the cache and notify watchers of the error.
|
|
|
|
// remove it from the cache and notify watchers that it does not exist.
|
|
|
|
for (const auto& p : cds_state.subscribed_resources) { |
|
|
|
for (const auto& p : cds_state.subscribed_resources) { |
|
|
|
const std::string& cluster_name = p.first; |
|
|
|
const std::string& cluster_name = p.first; |
|
|
|
if (cds_update_map.find(cluster_name) == cds_update_map.end()) { |
|
|
|
if (cds_update_map.find(cluster_name) == cds_update_map.end()) { |
|
|
|
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name]; |
|
|
|
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name]; |
|
|
|
cluster_state.update.reset(); |
|
|
|
cluster_state.update.reset(); |
|
|
|
for (const auto& p : cluster_state.watchers) { |
|
|
|
for (const auto& p : cluster_state.watchers) { |
|
|
|
p.first->OnError(GRPC_ERROR_CREATE_FROM_STATIC_STRING( |
|
|
|
p.first->OnResourceDoesNotExist(); |
|
|
|
"Cluster not present in CDS update")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// Also remove any EDS resources that are no longer referred to by any CDS
|
|
|
|
// For any EDS resource that is no longer referred to by any CDS
|
|
|
|
// resources.
|
|
|
|
// resources, remove it from the cache and notify watchers that it
|
|
|
|
|
|
|
|
// does not exist.
|
|
|
|
auto& eds_state = state_map_[XdsApi::kEdsTypeUrl]; |
|
|
|
auto& eds_state = state_map_[XdsApi::kEdsTypeUrl]; |
|
|
|
for (const auto& p : eds_state.subscribed_resources) { |
|
|
|
for (const auto& p : eds_state.subscribed_resources) { |
|
|
|
const std::string& eds_resource_name = p.first; |
|
|
|
const std::string& eds_resource_name = p.first; |
|
|
@ -1074,8 +1080,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate( |
|
|
|
xds_client()->endpoint_map_[eds_resource_name]; |
|
|
|
xds_client()->endpoint_map_[eds_resource_name]; |
|
|
|
endpoint_state.update.reset(); |
|
|
|
endpoint_state.update.reset(); |
|
|
|
for (const auto& p : endpoint_state.watchers) { |
|
|
|
for (const auto& p : endpoint_state.watchers) { |
|
|
|
p.first->OnError(GRPC_ERROR_CREATE_FROM_STATIC_STRING( |
|
|
|
p.first->OnResourceDoesNotExist(); |
|
|
|
"ClusterLoadAssignment resource removed due to CDS update")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|