Fixing the transient failure that occurs during the case

where CDS response missing a resource that we have newly requested
(the resource will likely be contained in subsequent responses).
pull/23863/head
Donna Dionne 4 years ago
parent f7fbbc1cf0
commit dc7f926b9e
  1. 7
      src/core/ext/xds/xds_client.cc
  2. 1
      test/cpp/end2end/xds_end2end_test.cc

@ -1022,6 +1022,13 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
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];
// If the resource was newly requested but has not yet been received,
// we don't want to generate an error for the watchers, because this CDS
// response may be in reaction to an earlier request that did not yet
// request the new resource, so its absence from the response does not
// necessarily indicate that the resource does not exist.
// For that case, we rely on the request timeout instead.
if (!cluster_state.update.has_value()) continue;
cluster_state.update.reset(); cluster_state.update.reset();
for (const auto& p : cluster_state.watchers) { for (const auto& p : cluster_state.watchers) {
p.first->OnResourceDoesNotExist(); p.first->OnResourceDoesNotExist();

@ -1545,6 +1545,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
"Performed %d warm up requests against the backends. " "Performed %d warm up requests against the backends. "
"%d succeeded, %d failed, %d dropped.", "%d succeeded, %d failed, %d dropped.",
num_total, num_ok, num_failure, num_drops); num_total, num_ok, num_failure, num_drops);
EXPECT_EQ(num_failure, 0);
return std::make_tuple(num_ok, num_failure, num_drops); return std::make_tuple(num_ok, num_failure, num_drops);
} }

Loading…
Cancel
Save