Fixing the transient failure that occurs during the case where (Porting

pull/23944/head
Donna Dionne 4 years ago
parent 8f4a45a689
commit 6088a5e027
  1. 7
      src/core/ext/filters/client_channel/xds/xds_client.cc
  2. 1
      test/cpp/end2end/xds_end2end_test.cc

@ -1034,6 +1034,13 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
const std::string& cluster_name = p.first;
if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
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();
for (const auto& p : cluster_state.watchers) {
p.first->OnResourceDoesNotExist();

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

Loading…
Cancel
Save